2
Matlabのperfcurve関数は、合理的なカットオフ値に対して2つのレコードが間違って分類された場合にAUC = 1をアサートします。 カットオフ0.5の混同行列で同じデータを実行した場合、精度は正当に1未満です。 MWEには私のフォールドのデータが含まれています。私は結果に完全精度未満の完全なaucを見たので、問題に気づいた。Matlab関数perfcurveが誤ってROCをアサートするAUC = 1
私はMatlab 2016aとUbuntu 16.4 64bitを使用します。
% These are the true classes in one of my test-set folds
classes = transpose([ones(1,9) 2*ones(1,7)])
% These are predictions from my classifier
% Class 1 is very well predicted
% Class 2 has two records predicted as class 1 with threshold 0.5
confidence = transpose([1.0 1.0 1.0 1.0 0.9999 1.0 1.0...
1.0 1.0 0.0 0.7694 0.0 0.9917 0.0 0.0269 0.002])
positiveClass = 1
% Nevertheless, the AUC yields a perfect 1
% I understand why X, Y, T have less values than classes and confidence
% Identical records are dealt with by one point on the ROC curve
[X,Y,T,AUC] = perfcurve(classes, confidence, positiveClass)
% The confusion matrix for comparison
threshold = 0.5
confus = confusionmat(classes,(confidence<threshold)+1)
accuracy = trace(confus)/sum(sum(confus))
しかし、ROCはとにかくカットオフ全体でスイープを実行します。たとえば、コンソール上のX、Y、Tの出力を見ると、0.9917 0.7694 – user7019377
@ user7019377それはすべての可能なカットオフを掃引し、それらのうちの1つが完全な分離を持つので、AUC = 1になります。 – Calimo
例えば、Tの0.9917と0.7694の閾値は、クラス2の例をクラス1として分類することにつながります。しかし、Yは完璧なTPR(特異性)を示し、XはFPR(完璧な感度)を示していません。 (私はここで新しいので、押しても早すぎる入力は編集ボタンを見つけることができません) – user7019377