HomeAI & Machine LearningROC Curves vs Precision-Recall Curves: Choosing the Right Threshold

🎯 ROC Curves vs Precision-Recall Curves: Choosing the Right Threshold

A 3D lab where two overlapping score distributions get sliced by a moving decision threshold, tracing out the ROC curve and the precision-recall curve live as class separation and class imbalance change.

AI & Machine Learning3DAdvanced60 FPS
roc-vs-precision-recall-curves-explained-lab ↗ Open standalone

Two overlapping score distributions — true negatives behind, true positives in front — get sliced live by a moving decision threshold, while a ROC curve and a precision-recall curve trace out on side boards as the threshold sweeps from strict to lenient.

🔬 What It Demonstrates

Every classification threshold trades recall against false alarms. The ROC curve's shape depends only on how separated the two classes are; the precision-recall curve additionally depends heavily on how rare the positive class is — which is exactly why the two curves can disagree.

🎮 How to Use

Drag the threshold to reclassify every bar instantly and watch both curve markers move. Lower class separability to simulate a weaker model, or drop the positive class share to simulate a rare-event problem, and see how the ROC curve barely reacts while the PR curve sags.

💡 Did You Know?

A dashed diagonal marks a random classifier's ROC curve (AUC = 0.5); on the PR board, the dashed horizontal line marks a random classifier's precision — which equals the positive class's prevalence, not 0.5.

⚙ Under the hood

A 3D lab where two overlapping score distributions get sliced by a moving decision threshold, tracing out the ROC curve and the precision-recall curve live as class separation and class imbalance change.

machine learningclassificationthresholdingroc curveprecision recallcurve fittingdata analysisThree.js

3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)