ROC & Threshold Explorer illustration

ROC & Threshold Explorer

A binary classifier reduces every example to a score, and a threshold turns scores into decisions. Two Gaussian score distributions — negatives in blue, positives in orange — follow your sliders for class separation d′, the spread of each class, prevalence and sample size, drawn both as smooth curves and as a histogram of an actual sample. Drag the vertical threshold line and every panel updates at once: the 2×2 confusion matrix recounts, the TPR, FPR, precision, recall, F1, specificity and accuracy readouts refresh, and the operating point slides along the ROC curve above the shaded AUC. Toggle the precision–recall view to see how prevalence changes the picture, then enter costs for false positives and false negatives to plot expected cost against threshold and find the marked optimum.

Runs 100% in your browser — models are trained and computed locally on your device.

Notes

  • AUC equals the probability that a randomly chosen positive scores higher than a randomly chosen negative; for two equal-variance Gaussians it is Φ(d′/√2).
  • ROC curves ignore prevalence: TPR and FPR are computed within each class, so the curve does not move as the class ratio changes — but precision and the PR curve do.
  • The cost-optimal threshold satisfies a likelihood-ratio condition: predict positive when p(x|+)/p(x|−) exceeds (c_FP/c_FN)·(1−π)/π, where π is the prevalence.
  • Runs 100% in your browser — models are trained and computed locally on your device.