Visual walkthrough — Confusion matrix interpretation
Step 1 — Start with reality: two piles of dots
WHAT. Imagine a screening test for a disease. Before the model says anything, every patient is truly one of two kinds:
- Positive — the person actually has the disease (draw them as plum dots).
- Negative — the person is actually healthy (draw them as teal dots).
We have not run any model yet. This is just the truth of the world.
WHY start here. Every word we will define — "true positive", "false alarm" — is measured against this truth. If we do not fix what "actually positive" means first, the labels TP/FP/FN/TN are meaningless. Truth is the ruler; predictions are what we measure with the ruler.
PICTURE. The left column is the sick pile, the right column is the healthy pile. Notice there are many more healthy dots — this is the imbalance that will trip up "accuracy" later.
Step 2 — The model draws a line: predictions appear
WHAT. Now the model looks at each patient and shouts one of two words: "Positive!" or "Negative!". We draw a vertical divider: everyone the model calls positive goes to the left of the line, everyone it calls negative goes to the right.
WHY a line. A classifier ultimately makes a yes/no cut. Whatever it computes inside (a probability, a score), it eventually thresholds it into two verdicts. That cut is the vertical line. Moving this line later is exactly the Binary Classification Thresholds idea.
PICTURE. Each dot now has two properties at once: its colour (its truth from Step 1) and which side of the line it landed on (the model's guess). Watch for dots whose colour disagrees with their side — those are the errors.
The vertical line splits the world into:
- left of line — every patient the model flagged as sick.
- right of line — every patient the model cleared as healthy.
Step 3 — Cross truth with guess: four cells are born
WHAT. Combine the two properties. Colour has 2 values, side-of-line has 2 values, so there are exactly kinds of dot. These four kinds are the four cells of the confusion matrix.
WHY exactly four. Two yes/no questions ("is it truly positive?" and "did the model say positive?") multiply to four combinations. Nothing is left over, nothing overlaps — every single dot lands in exactly one cell. That completeness is why the matrix is the full truth of performance.
PICTURE. A 2×2 grid. Rows = the truth (plum = actually positive on top, teal = actually negative on bottom). Columns = the guess (predicted positive on left, predicted negative on right). Each dot from Step 2 drops into its cell.
Our medical numbers (from the parent note) fill the grid like this:
- : sick people correctly flagged.
- : sick people wrongly sent home.
- : healthy people wrongly alarmed.
- : healthy people correctly cleared.
Step 4 — Reading a column: precision
WHAT. Cover everything except the left column (everyone the model called positive): that is dots. Ask: of these, how many were actually positive (plum)?
- Numerator — the alarms that were right.
- Denominator — all alarms I raised, right or wrong.
WHY divide by the column. Precision answers "when I shout Positive, should you believe me?" The universe of that question is only the dots I shouted about — the predicted-positive column. Truth outside that column is irrelevant to this question, so it is not in the fraction.
PICTURE. The left column is highlighted. Precision is the plum fraction inside that highlighted strip.
So only ~62% of "you're sick" verdicts were true. More in Precision and Recall.
Step 5 — Reading a row: recall
WHAT. Now cover everything except the top row (everyone who is actually positive): that is dots. Ask: of these real positives, how many did the model catch?
- Numerator — real positives I found.
- Denominator — every real positive, found or missed.
WHY divide by the row. Recall answers "of everyone who truly has the disease, how many did I find?" The universe is now the truth pile — the top row — regardless of what the model guessed elsewhere. That is why the switch from precision to recall is literally a switch from reading a column to reading a row.
PICTURE. The top row is highlighted. Recall is the caught fraction inside that strip — and the missed FN dots stare back at you in red.
We caught 80%. Twenty sick people were sent home. See Class Imbalance Handling and Cost-Sensitive Learning for why that FN matters more here than an FP.
Step 6 — The other row: specificity, and the whole-grid view (accuracy)
WHAT. There is a second row we have not read: the bottom row, the truly-negative patients (). The fraction we correctly cleared is specificity:
- Numerator — healthy people correctly cleared.
- Denominator — all healthy people.
And if we stop reading strips and just take the whole grid, the correct dots are the diagonal over everything:
WHY show them together. Recall reads the top row, specificity reads the bottom row, and accuracy reads the whole board. Precision alone reads a column. Seeing all four viewpoints on one grid is the entire point of the matrix: one table, four honest questions.
PICTURE. The same grid, colour-coded by which strip each metric reads.
Step 7 — Degenerate cases: what happens at the extremes
WHAT. Slide the model's line all the way to one side, or feed it a lopsided world, and watch the metrics break. Every edge below is a real failure mode.
WHY cover these. A metric you only trust in the "nice" middle is a trap. You must know what each ratio does when a cell hits zero or when the classes are wildly imbalanced.
PICTURE. Three tiny grids side by side, each showing one extreme.
-
Line pushed fully right — model always says "Negative". Then .
- Recall — catches nothing.
- Precision — undefined (). By convention we report , because "no correct alarms out of no alarms" deserves no credit.
- Accuracy can still look huge if negatives dominate: this is the "predict all negative" 99%-accuracy fraud trap.
-
Line pushed fully left — model always says "Positive". Then .
- Recall — catches everything.
- Specificity — clears no one; a firehose of false alarms.
- Precision collapses toward the base rate of positives.
-
Perfect classifier. , all mass on the diagonal → every metric . This is the matrix a Model Selection Criteria dream would produce, and why we watch the off-diagonal to measure distance from it.
Step 8 — Why uses the harmonic mean
WHAT. Precision and recall pull in opposite directions as you slide the line (Steps 4–5). We want one number that is only happy when both are high. The choice is the harmonic mean:
- — flipping each ratio makes a small value explode, so a low P or R dominates the sum.
- The factor — makes when .
- Final form — cancels back into raw cell counts; note the two easy cells TP and... the TN never appears, so ignores true negatives (great for imbalance).
WHY not the plain average. With , the arithmetic mean rewards a broken model. The harmonic mean gives — it refuses to be fooled.
PICTURE. Two curves over the same : the arithmetic mean stays fat and forgiving; the harmonic mean sags hard toward whichever value is small.
For our medical model:
The one-picture summary
Everything above, on one board: the four cells, the column you read for precision, the two rows you read for recall and specificity, the diagonal you read for accuracy, and the arrows that turn cells into metrics.
Recall Feynman retelling — say it in plain words
Real life sorts people into positive and negative — that is the colour of each dot. The model draws a line and guesses positive or negative — that is which side each dot lands on. Cross the two and you get four boxes: correct catches (TP), missed cases (FN), false alarms (FP), correct clearances (TN). Every famous score is just which box you divide by: read the predicted-positive column and you get precision ("believe me when I shout?"); read the actual-positive row and you get recall ("did I find them all?"); read the actual-negative row and you get specificity ("did I avoid false alarms?"); read the whole board's diagonal and you get accuracy. Push the line to an extreme and the scores break in predictable ways — all-negative kills recall and makes precision undefined; all-positive kills specificity. And because precision and recall fight each other, takes their harmonic mean so it is only pleased when both are high. One table, and your finger explains classification.
Recall
Which strip of the matrix does precision read? ::: The predicted-positive column (). Which strip does recall read? ::: The actual-positive row (). What is in words? ::: A truly positive case the model missed (said negative) — Type II error. Why harmonic and not arithmetic mean for ? ::: The harmonic mean is dragged down by a small value, so is high only when precision and recall are both high. Model always predicts "negative": what are recall and precision? ::: Recall ; precision is , undefined (reported as ).
Related: ROC Curve and AUC · Multi-class Classification Metrics · Binary Classification Thresholds