Confusion Matrix

A confusion matrix is a table that breaks down a classification model's predictions by comparing predicted classes against true classes, showing where the model is right and exactly which classes it confuses. It is the basis for accuracy, precision, recall, and per-class error analysis.

What is a confusion matrix?

A confusion matrix is a grid with one axis for the true class and one for the predicted class. The diagonal holds the correct predictions, and every off-diagonal cell tells you how often one class was mistaken for another. For a binary problem it reduces to four cells: true positives, false positives, false negatives, and true negatives. Its value is that it does not collapse performance into one number, it shows the shape of a model's mistakes, and nearly every other classification metric is derived from it.

Key takeaways

  • It is a table of true versus predicted classes, with correct predictions on the diagonal and confusions off it.
  • For binary tasks it holds true positives, false positives, false negatives, and true negatives.
  • Accuracy, precision, recall, and F1 are all computed from the matrix.

How to read it

  • Fix your convention: typically rows are the true class and columns are the predicted class.
  • A bright off-diagonal cell is a systematic confusion between two specific classes.
  • Normalize each row to read per-class recall, how often each true class is correctly found.

How it works, and how FiftyOne fits

FiftyOne's evaluation renders an interactive confusion matrix you can click into to see the actual samples behind each cell, so a "car versus truck" confusion stops being a number and becomes the specific images to inspect and fix. See the FiftyOne model evaluation guide in the docs.

Confusion matrix vs derived metrics

Definition for confusion matrix and its derived terms
Definition for confusion matrix and its derived terms
TermWhat it is
Confusion matrixThe full table of true versus predicted classes
AccuracyThe diagonal total over the grand total
Precision and recallColumn-wise and row-wise ratios pulled from the matrix

Why it matters

If accuracy tells you how much a model gets wrong, the confusion matrix tells you what it gets wrong, and that is where the fixes are. Information-gain insight: two patterns carry most of the signal. A bright off-diagonal cell means two classes are systematically confused, which is usually an ontology or labeling problem, ambiguous class boundaries, not a model problem, so the fix is in the schema and the labels. An entire dark row means a class the model almost never finds, often a rare or under-labeled class. Both point you to data and schema work rather than just more training.

Frequently asked questions

What is a confusion matrix?

A table comparing a model's predicted classes against the true classes, showing correct predictions and specific confusions.

How do you read a confusion matrix?

The diagonal is correct predictions, off-diagonal cells show which classes are mistaken for which, and normalizing rows gives per-class recall.

What metrics come from a confusion matrix?

Accuracy, precision, recall, and F1 are all derived from its cells.

Related terms

Accuracy, Mean Squared Error, Object detection, Image classification, Annotation quality

Try it in FiftyOne

Build an interactive confusion matrix and click into the exact samples behind each cell in the classification evaluation tutorial.

Learn more

Explore the full evaluation workflow on the model evaluation page.
Last updated July 1, 2026

Building visual or physical AI?

Let's talk.