What is a Confusion Matrix?
The confusion matrix, told as a story about a ledger that splits the sorter's calls against the real state into four boxes.
The sorter boasts 99% accuracy.Only 1 of 100 is rotten — stamping everything PASS still scores 99%.
Accuracy alone hides the mistake of missing rare rotten produce.Missing the rotten item every time still leaves the accuracy number looking fine.
A confusion matrix is a ledger splitting each item's real state against the sorter's call into four boxes.Here a rotten item counts as positive. Not just one number — the ledger shows exactly which kind of mistake happened.
Several metrics are computed straight from the four boxes.Which metric matters most depends on which kind of mistake costs more.
Which costs more, FN or FP, depends on the situation.Where the cutoff is set comes down to weighing these two costs against each other.
Confusion matrix = a ledger splitting each item's real state against the sorter's call into four boxes (TP, TN, FP, FN).
A confusion matrix cross-tabulates a classifier's predictions against the ground truth into four boxes: TP (true positive), TN (true negative), FP (false positive), and FN (false negative). From these four numbers, metrics like accuracy, precision, recall, and the F1 score are derived. When a dataset is imbalanced, accuracy alone can't reveal a model's real performance — the confusion matrix has to be read alongside it.
When grown-ups say it
- Confusion matrix
- A ledger splitting the real state against the call into four boxes. Reveals the mistakes accuracy alone would hide.
- Accuracy
- Correct out of everything. Unreliable when the classes are imbalanced.
- Precision
- Of what it called REJECT, how much was really rotten. Matters most when false alarms are the costly mistake.
- Recall
- Of what's really rotten, how much it caught. Matters most when a miss is the costly mistake.
- Imbalanced data
- A situation where only 1 in 100 is rotten. Connects back to bias at the seed stage. → A Sorter Trained on Rotten Seed
- Threshold
- The cutoff line that splits PASS from REJECT. Moving this line trades off FP against FN.
- False alarm vs. miss
- A wrongful reject vs. letting a rotten one through. An adversarial attack ultimately shifts these same four numbers. → The Fake Dot Pattern Snuck Onto the Produce
- ROC · AUC
- The performance curve traced by sliding the threshold. Not one confusion matrix, but many of them strung together across thresholds.