Perfcurve with multiple negative classes
7 views (last 30 days)
Show older comments
Philipp on 25 Jul 2013
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 on 25 Jul 2013
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],...
title('Two ROC curves')
More Answers (0)
Find more on ROC - AUC in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!