ROC & Precision-Recall Explorer

Interactive ROC and precision-recall curves from scores and labels: drag the threshold, read the confusion matrix, AUC, average precision, F1, MCC and the cost-optimal cutoff.

About this tool

Compare binary classifier rankings and choose a decision threshold. Higher scores must mean more likely positive; probabilities are not required.

Input: exactly two columns, score,label, one case per record. Comma, semicolon, tab and pipe are detected. For decimal commas use semicolon, tab or a quoted score. Labels accept 1/0, true/false, yes/no, pos/neg, their single-letter aliases and positive/negative. Enable the header checkbox only when the first record is a header. Blank records are ignored; malformed records and inputs above 20,000 cases or 1 MiB are rejected as a whole. Import fills the editor; Analyze calculates. Editing clears the old result.

Curves: equal scores are processed together. ROC AUC uses trapezoids and equals the fraction of positive/negative pairs correctly ranked, with half credit for ties. Average precision (AP) is Σ Δrecall × precision at each score group; it is not trapezoidal PR AUC. The PR graph uses this step convention. All operating points are drawn; SVG coordinates are rounded to display pixels. The dashed baselines are chance on ROC and prevalence on PR. The orange point follows the slider; at no predicted positives, precision is undefined (—), while the PR marker uses the conventional (0,1) endpoint.

Threshold: predict positive when score ≥ threshold. Scores are shown without rounding away significant digits. The default maximises F1. The four suggestions maximise F1 or Youden’s J, minimise squared distance to (0,1) on ROC, or minimise (FP cost × FP + FN cost × FN) / case count. Ties choose the first point, i.e. the highest threshold, including no positive predictions. Costs must be finite, nonnegative and ≤ 10¹². Invalid costs suppress only the cost result and cost suggestion.

Metrics: recall = TP/(TP+FN), precision = TP/(TP+FP), FPR = FP/(FP+TN), specificity = 1−FPR, F1 = 2TP/(2TP+FP+FN). More metrics contains prevalence, NPV, accuracy, balanced accuracy, MCC and Youden’s J. Undefined precision or NPV is —; F1 and MCC use zero for a zero denominator.

Example: 0.9,1 / 0.8,0 / 0.7,1 / 0.2,0: AUC 0.75, AP 5/6; threshold 0.7 gives TP 2, FP 1, FN 0, TN 1 and F1 0.8. Presets are synthetic Gaussian populations mapped through a logistic function and rounded to four decimals.

Export: CSV contains every threshold and confusion count, recall, FPR, precision and F1 at full JavaScript precision. A blank threshold denotes no positive predictions; blank precision is undefined. No observations are uploaded.

Limits: binary, unweighted cases, no confidence intervals or calibration assessment. Choose thresholds on validation data and confirm them on independent test data; optimising a cutoff on the same cases gives an optimistic evaluation. ROC and PR describe complementary aspects, especially with rare positives.

Only input values are remembered in this browser. Calculated results and experiment histories are not saved.