2
$\begingroup$

It might sound like a stupid question, but I've got to ask it. Let's say I have a classifier, with one discrete bounded parameter. I have run the classifier over all possible parameter values, and computed sensitivity specificity and accuracy for each parameter value.

Is there a way to compute the ROC curve from this list of measures?

I tried to plot ( sensitivity, 1-specificity ) but the result is a line crisscrossing itself many times.

$\endgroup$
4
$\begingroup$

I think you are misunderstanding the concept of a ROC curve. I also had the same problem when I first was exposed to the idea. You can draw a ROC curve on a SINGLE model. You need to change the threshold of your classification for the same model. For instance, imagine I have a logistic regression. I will have my function return probabilities instead of labels. Now if I assign P<0.5 ( probability greater than 0.5) to be class 1 and P<0.5 to be class 0. That will change my True positives and negatives and False positives and negatives, making me have a sensitivity and specificity. Now on the same model I will change the threshold, from say 0.1 to 0.9, such that for example, P>0.9 means class 1 and P<0.9 is class 0. Gather the sensitivity and specificity for all these thresholds and plot them on a sensitivity vs 1-specificity, and you should have your ROC curve. They should both go from 0 to 1. It is fairly simple to write a ROC curve from the scratch, but there are packages, what language are you using?

$\endgroup$
  • $\begingroup$ it's python, and there is already some libraries which one could use to compute and plot the ROC curve. :-) I just wanted to understand what the library does.... $\endgroup$ – user1384636 May 31 '15 at 10:52
  • $\begingroup$ yes python has everything :D I think I used scikit-learns roc_curve myself. The function simply takes the probabilities and the true values, and does the above mentioned to the probabilities and produces the curve comparing it to the true labels scikit-learn.org/stable/modules/generated/… $\endgroup$ – plumSemPy May 31 '15 at 10:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.