How to compute `AUC` for NN (`patternnet`)?

5 ビュー (過去 30 日間)
elham
elham 2020 年 11 月 27 日
コメント済み: Jan Schulze 2022 年 5 月 6 日
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."
I have also seen the related links such as: Link1, Link2, Link3.
  1 件のコメント
Jan Schulze
Jan Schulze 2022 年 5 月 6 日
I have the same question. can anybody help us?

サインインしてコメントする。

回答 (0 件)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by