Classification Metrics and Threshold Sandbox

FPR
FP / (FP+TN)
0.00
TPR
TP / (TP+FN)
0.00
ROC-AUC
Area under ROC
0.00

How to read ROC Curve

Precision
TP / (TP+FP)
0.00
Recall
TP / (TP+FN)
0.00
PR-AUC
Area under PR
0.00

How to read PR Curve

Threshold
0.50
Disease Prevalence
50%
Distribution Means
Healthy Mean
0.35
Sick Mean
0.65
Accuracy
(TP+TN) / Total = (0 + 0) / 10,000 = 0.000
0.00
Legend
TN (Healthy and Negative - True Healthy)
FP (Healthy and Positive - False Alarm)
FN (Sick and Negative - Missed Sick)
TP (Sick and Positive - True Sick)
Calculation Components
PPV
TP / (TP+FP)
0.00
NPV
TN / (TN+FN)
0.00
Sensitivity
TP / (TP+FN)
0.00
Specificity
TN / (TN+FP)
0.00

Assumptions Behind These Numbers

Exercises

Exercise 1

Pick a Threshold

A disease affects 1 in 5 people. A model gives higher scores to patients who are more likely to be sick.

What threshold would you choose if the clinic wants to catch most sick people, even if some healthy people get flagged?

  • What if the clinic has limited testing capacity?
  • What if missing a sick patient is 10 times worse than a false alarm?
  • Would your threshold be closer to 50, 60, or 70?
Exercise 2

Hospital Capacity

A hospital can only follow up with 100 patients per day. The model scores 1,000 patients each morning.

Should the cutoff be fixed, like "flag everyone above 80," or capacity-based, like "flag the top 100 scores"?

  • What are the risks of each approach?
  • What if tomorrow's patient population is much sicker?
  • What if the model scores drift over time?
Exercise 3

Changing the Population

A model was trained in a hospital where 30% of patients had the disease. Now it is used in a primary care clinic where only 5% have it.

Should the threshold stay the same?

  • What changes when prevalence drops from 30% to 5%?
  • What happens to positive predictive value?
  • Would you recalibrate the model, change the threshold, or both?

Accuracy or AUC?

The healthy or sick score is the model's confidence that a patient is healthy or sick. Accuracy and AUC/ROC are two metrics used to grade that model.

Accuracy changes with the threshold because it measures how many classifications are correct at one chosen threshold. It is useful for picking or evaluating a cutoff, but it can be misleading if prevalence or false-positive and false-negative costs are uneven.

AUC/ROC is constant across thresholds because it measures how well the score ranks sick cases above healthy cases across all possible thresholds. It is a discrimination metric.