ML0015 ROC Curve

What is the ROC Curve, and how is it plotted?

Answer

The ROC (Receiver Operating Characteristic) curve is a graphical tool for evaluating a binary classifier by plotting the true positive rate against the false positive rate at every classification threshold. Because models output scores rather than hard labels, a threshold decides what counts as positive; sweeping that threshold from strict to lenient traces out the curve. To plot it: train the binary classifier, generate probability scores for the positive class, compute TPR and FPR at many threshold values, then plot TPR versus FPR. Reading the curve: points near the top-left corner mean high TPR with low FPR: excellent performance; the diagonal is random guessing; curves below the diagonal are worse than random (and can be flipped to beat it); a perfect classifier sits at the single point (0, 1).

(1) Axes: Y is TPR (recall, sensitivity); X is FPR (1 − specificity); both sweep with the threshold.
(2) How It Is Built: Score the data, then recompute the confusion counts at every candidate threshold and connect the points.
(3) Reading It: Closer to the top-left corner is better; the diagonal is random; (0, 1) is perfect.

ROC curves for better than random, worse than random, random, and perfect classifiers

Figure 1: Reference ROC curves: the further a model bows toward the top-left corner, the better it ranks positives above negatives.

Mathematical Formulation:
\text{TPR}(\tau) = \frac{TP(\tau)}{TP(\tau) + FN(\tau)}
\text{FPR}(\tau) = \frac{FP(\tau)}{FP(\tau) + TN(\tau)}

Where:

  • \tau is the classification threshold; varying it from 1 down to 0 traces the curve.
  • TP(\tau), FP(\tau), FN(\tau), and TN(\tau) are the confusion-matrix counts at threshold \tau.
  • \text{TPR} is the true positive rate (same as recall) and \text{FPR} is the false positive rate, the curve’s two axes.

Login to view more content


Log in to track your progress

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *