← Lessons

quiz vs the machine

Silver1140

Machine Learning

Reading The Confusion Matrix

A simple table that exposes exactly how a classifier gets things wrong.

4 min read · intro · beat Silver to climb

Beyond a single number

Accuracy collapses all of a classifier's behavior into one figure, hiding which errors it makes. A confusion matrix lays predictions against truth in a small table so you can see the full pattern of right and wrong answers.

Reading the table

For a two class problem the matrix has four cells:

  • True positives, correctly predicted positives
  • True negatives, correctly predicted negatives
  • False positives, negatives wrongly flagged positive, a false alarm
  • False negatives, positives that were missed

From these four counts you can derive almost every classification metric, including precision, recall, and accuracy. The same idea extends to many classes, where the diagonal holds correct predictions and off diagonal cells show which classes get confused for which.

Why it helps

Seeing the off diagonal tells you whether a model confuses similar classes, which guides where to add data or features.

Key idea

The confusion matrix tabulates predictions against truth, revealing the specific kinds of errors and serving as the source for most classification metrics.

Check yourself

Answer to earn rating on the learn ladder.

1. A false negative is what?

2. In a multiclass confusion matrix, the diagonal holds what?