Reference · How-to · ~5 min
How to read a confusion matrix
Last updated
Turn a table of predictions into actionable precision, recall, and error patterns.
Turn a table of predictions into actionable precision, recall, and error patterns.
#Steps
1. **Rows = true label, columns = predicted label** — locate true positives (TP), false positives (FP), false negatives (FN), true negatives (TN)
2. **Ask the business question** — is a false alarm or a missed case more costly?
3. **Compute metrics**
4. **Check imbalance** — high accuracy can hide useless models on rare classes
5. **Slice errors** — group FPs/FNs by segment (language, product, time) for fixes
#Example table
| | Pred spam | Pred not spam |
|--|-----------|---------------|
| True spam | TP | FN ← missed spam |
| True not spam | FP ← false alarm | TN |
#Watch out
One number never tells the story — pair the matrix with **threshold tuning** and **class weights**.