What Is a Confusion Matrix? A Plain-Language Explanation

Updated · By Viviai

A confusion matrix is a table used to evaluate a classification model by comparing predicted labels with actual labels, organizing the results into four counts: true positives, true negatives, false positives, and false negatives.

The simple analogy

A teacher marking yes/no answers wants to know not just how many were wrong, but the direction of each mistake. A confusion matrix separates correct answers from the two kinds of errors so the model's weaknesses are visible.

The four cells

Term Meaning
True Positive (TP) Correctly predicted positive
True Negative (TN) Correctly predicted negative
False Positive (FP) Actually negative, predicted positive
False Negative (FN) Actually positive, predicted negative

Metrics derived from it

Why accuracy alone can mislead

When one class is much more common, a model can show high accuracy while missing the rare class. The confusion matrix reveals those errors directly.

Honest caveats

A confusion matrix is mainly used for classification rather than regression, and it becomes larger with more classes. It describes performance but does not by itself explain why errors occur.

FAQ

What is a false positive?

A negative case that the model incorrectly predicted as positive.

What is a false negative?

A positive case that the model incorrectly predicted as negative.

How do precision and recall differ?

Precision focuses on the reliability of positive predictions, while recall focuses on how many real positives were found.

When is accuracy misleading?

When classes are imbalanced, a dominant class can inflate accuracy.

Key takeaways

Continue with what is cross-validation and what is model evaluation.

Sources

  1. https://www.ibm.com/think/topics/confusion-matrix
  2. http://www.shturl.cc/81525ee300316f737215abc50528a7dc
  3. https://developers.google.cn/machine-learning/crash-course/classification/accuracy-precision-recall

Learn by doing

Read a guide, then practice with bite-sized AI lessons you can take offline.

Start learning free