Back to Study Material Machine Learning

ROC curve

A receiver operating characteristic curve, or ROC curve, is a graphical tool for evaluating binary classifiers across all possible classification threshold...

ROC curve

Visualizing the Trade-Off Between Sensitivity and Specificity

A receiver operating characteristic curve, or ROC curve, is a graphical tool for evaluating binary classifiers across all possible classification thresholds. Instead of committing to a single threshold and reporting one pair of precision and recall values, the ROC curve plots the true positive rate against the false positive rate as the threshold is swept from zero to one, revealing the full range of trade-offs the classifier can make.

The true positive rate, also called recall or sensitivity, is the fraction of actual positives the model correctly identifies. The false positive rate is the fraction of actual negatives the model incorrectly labels as positive. A perfect classifier has a point at the top-left corner: true positive rate of one and false positive rate of zero. A random classifier that ignores the features produces a diagonal line from bottom-left to top-right, because raising the threshold to accept more positives increases both rates equally.

A curve that bows strongly toward the top-left corner indicates a model that achieves high true positive rates while keeping false positive rates low — a strong classifier. A curve close to the diagonal indicates a model barely better than chance.

The ROC curve is especially valuable when class distribution changes after deployment, because the curve itself does not depend on class proportions. This contrasts with precision-recall curves, which are sensitive to class imbalance and are often preferred when the positive class is rare.

A concrete example: a disease screening test is evaluated at thresholds of 0.1, 0.3, 0.5, 0.7, and 0.9. At threshold 0.3 the model catches 92 percent of diseased patients but also flags 20 percent of healthy ones. At 0.7 it flags only 5 percent of healthy patients but misses 40 percent of diseased ones. The ROC curve shows both extremes and everything in between.

Exam tip: know that the ROC curve is threshold-invariant, meaning it shows all possible operating points, and that you compare classifiers by comparing the area under their ROC curves.