How to compute `AUC` for NN (`patternnet`)?
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
According to the following code of Matlab, I'm trying to get the AUC of a neural network (patternnet), so I have used the perfcurve function (see the related outputs):
(There are two different classes - labeled 0, 1).
[net, tr] = train(net, xtrain', ytrain'); % xtrain = 64x4; xtest = 7x4;
y_pred = net(xtest');
[~,indicesPredicted] = max(y_pred,[],1);
% output of y_pred (2x7):
% [0.557, 0.557, 0.557, 0.557, 0.788, 0.574, 0.557;
% 0.442, 0.442, 0.442, 0.442, 0.212, 0.425, 0.442]
%
% and so the output of
% indicesPredicted is [1, 1, 1, 1, 1, 1, 1];
score = y_pred';
[~,~,~,AUC] = perfcurve(indicesReal', score(:,2), 1); % indicesReal = [0, 1, 1, 1, 0, 0, 0];
% The output of AUC is 1.
While the result of AUC isn't correct because:
predicted Real
ans = ans =
1 (class 2) 0 (class 1)
1 (class 2) 1 (class 2)
1 (class 2) 1 (class 2)
1 (class 2) 1 (class 2)
1 (class 2) 0 (class 1)
1 (class 2) 0 (class 1)
1 (class 2) 0 (class 1)
How to compute the posterior probabilities (scores) for NN (patternnet) to get AUC?
Also, I have tested the [y_pred, score] = predict(net, xtest); and an error has occurred about predict:
"Error using predict
No valid system or dataset was specified."
1 Kommentar
Antworten (0)
Siehe auch
Kategorien
Mehr zu Classification Ensembles finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!