Confusion Matrix: Precision, Recall & F1

Interactive explainer — adjust sliders and click cells to explore how metrics relate to each other.

Every prediction falls into one of four buckets. True/False = was the model right? Positive/Negative = what did it predict? Click any cell or metric below to see how they connect.

Live Confusion Matrix
TP 40
Correct positives
TN 50
Correct negatives
FP 10
Wrong positives
FN 8
Missed positives
Presets
Confusion Matrix
Pred +
Pred −
Pos
40
TP
8
FN
Neg
10
FP
50
TN
Metrics
Precision
80%
Recall
83%
F1 Score
82%
Accuracy
85%
Click any cell or metric above
Or load a preset to see how metrics behave in different situations.

When to use which metric

Precision: use when false positives are costly (e.g. spam filters, fraud flags). Formula: TP / (TP + FP).

Recall: use when false negatives are costly (e.g. cancer screening, fault detection). Formula: TP / (TP + FN).

F1: harmonic mean of precision and recall. Useful when both matter and classes are imbalanced. If either is 0, F1 is 0.

Accuracy: use only on balanced datasets. On a 95/5 class split, always predicting the majority gives 95% accuracy with 0% recall.

Quick Reference

What you observe What it means
High accuracy, low recall Model is hiding behind class imbalance. Don't ship it as-is.
High precision, low recall Very conservative. Safe for low-stakes alerts; dangerous when missing cases matters.
High recall, low precision Catches nearly everything but triggers many false alarms.
High F1 Genuinely balanced. The metric to trust on imbalanced datasets.
F1 = 0 Either precision or recall is zero — the model is not working.