Skip to content

AI Glossary · Metrics

What is Confusion Matrix?

Confusion Matrix

A confusion matrix is a table that breaks a classifier's predictions down by what actually happened: true positives, false positives, true negatives and false negatives. It shows which kinds of mistakes a model makes, not just how many.

Also known as: error matrix

· Chain of Thought

AI Evaluation & Reliability

  • 2 sources

Suppose a spam filter checks 1,000 emails. A single accuracy number, say 95%, hides the important detail. The confusion matrix shows it in four boxes: spam correctly caught (true positives), real mail wrongly sent to spam (false positives), spam that slipped into the inbox (false negatives) and real mail correctly delivered (true negatives). For most people a lost job offer in the spam folder is far worse than one extra junk email, and only the matrix tells you which mistake the filter makes.

Most classification metrics are just ratios of these boxes. Precision is true positives divided by everything flagged; recall is true positives divided by everything that should have been flagged; the F1 score combines the two. Changing the decision threshold moves examples between boxes, which is what the ROC curve and AUC summarize. For problems with more than two classes, the matrix grows to one row and column per class, and off-diagonal cells reveal which classes the model mixes up, for example “cat” mistaken for “fox.”

It’s the natural first view for any yes/no system, whether a fraud model, a medical test or an LLM-based content filter or guardrail, and it’s essential for imbalanced datasets, where accuracy is misleading. The two error types are covered in false positives and false negatives.

Sources