Start studying
Module 1 · Machine Learning Module contents
Module 1  ·  Card 42 / 55beginner

Confusion Matrix

A confusion matrix is a table of predicted class against actual class.

For binary problems it holds true positives, false positives, true negatives and false negatives.

It shows you exactly what kind of mistake the model is making.

Almost every classification metric is computed from these four numbers.

It is far more informative than a single accuracy figure.

Learn in depth ↓
Module 01 · Machine Learning · 55 concepts
In depth  /  15 lines

Confusion Matrix, in more detail

Everything you can say about a classifier starts from four counts.

True positives are the cases it flagged and was right about.

False positives are the ones it flagged that were actually fine.

False negatives are the real cases it missed entirely.

True negatives are the ordinary cases it correctly left alone.

Laid out as a small square, those four counts are the confusion matrix.

Accuracy, precision, recall and the rest are all arithmetic on these numbers.

The reason to look at the square is that the four are not interchangeable.

Two models with identical accuracy can make completely different mistakes.

One misses real cases, the other raises false alarms, and only the square shows it.

Which of those you can live with is a decision about the real world.

With more than two classes it becomes a bigger grid, one row per true class.

Then it shows exactly which classes are being mistaken for which.

Very often two similar classes account for most of the errors.

That tells you where to spend your effort, which a single score never does.

Want the full technical article? Wikipedia ↗
Test yourself

One question on this card. Every option explains itself once you pick, right or wrong.

Question 1
Why look at the confusion matrix rather than accuracy alone?
Machine Learning

55 concepts in this module, then a graded test with every answer explained.

Study this module →
↑↓ move↵ openesc close