Perfcurve with multiple negative classes

4 次查看(过去 30 天)
Hi,
I want to do a classifier analysis, with 2 negative classes (classes 1 and 3). In labels, there are the true classes (1x30 double) with labels 1, 2 or 3. In scores, i measurement values (1x30 double), going from 0 to 114. I expect suby to be the result for classifying group 2 from group 1 and group 2 respectively. suby has the correct dimension of 30x2 double, and subynames is a correct 1x2 cell, with the class names 1 and 3.
But the 2 columns of suby are exactly equal and equal to y. What is wrong? I want two ROC curves of two independent classifiers, one for group 2 versus group 1 and one of group 2 versus group 3. So what is the sense behind suby?
posclass = 2;
negclass = [1 3];
[x,y,t,auc,optrocpt,suby,subynames] = perfcurve(labels,scores,posclass,'negClass',negclass);
Thank you, Philipp

采纳的回答

Ilya
Ilya 2013-7-25
By default, the Y criterion is TPR computed for all possible score thresholds. The score thresholds are distinct values in the 2nd input to perfcurve - they do not depend on the negative class. TPR at a fixed threshold depends only on the scores for the positive class. That's why you get two identical columns in suby. If you want to compute two ROC curves at once, swap the X and Y criteria:
s = rand(30,1);
Y = datasample(1:3,30)';
[x,y,t,auc,optrocpt,suby,subynames] = perfcurve(Y,s,2,'negClass',[1 3],...
'ycrit','fpr','xcrit','tpr');
plot(suby(:,1),x)
hold
plot(suby(:,2),x,'r')
hold off
title('Two ROC curves')

更多回答(0 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by