ROC curve for a binary classifier in MATLAB
Asked Answered
M

1

4

I have a binary classifier, which classifies an input X as class zero if its predicted value is below some threshold (say T), and one otherwise.
I have all predicted and actual values for every input. So I can have both predicted class and actual class of an input.

Now I want to have the ROC curve for this classifier with MATLAB. How should I do it?

Micamicaela answered 15/12, 2013 at 22:17 Comment(0)
T
5

Use perfcurve:

[X,Y] = perfcurve(labels,scores,posclass);
plot(X,Y);

labels are the true labels of the data, scores are the output scores from your classifier (before the threshold) and posclass is the positive class in your labels.

Teakettle answered 15/12, 2013 at 22:18 Comment(4)
What do X and Y represent?Micamicaela
@MatinKh X is false positive rate, Y is true positive rate by default. You can change them as well. Check this page: mathworks.com/help/stats/perfcurve.htmlMistranslate
@MatinKh X and Y are the values for the axis of the ROC plot.Teakettle
@Teakettle You have mentioned that scores are output scores from classifier before applying threshold. Then how do we apply thresholdWarrenne

© 2022 - 2024 — McMap. All rights reserved.