shapesinfinity.
Learn AI · Beginner · 3 min

The Confusion Matrix

Did you know AI makes mistakes? Here is how we measure them.

The Four-Box Grid
Correct guessesWrong guessesYes predictionsNo predictionsTrue answerCheck patterns

Top row shows AI said yes. Bottom row shows AI said no. Left column shows truth was yes. Right column shows truth was no.

comes outgoes inthe AI works

In simple words

Imagine a test where you guess if fruit is ripe or not. A grid shows your right and wrong guesses side by side.

The real definition

A confusion matrix is a table that shows where a model got predictions right and wrong. It helps you see which mistakes happen most.

Like… A Doctor Test

A doctor checks patients for a disease. Some tests are right, some are wrong. The matrix shows which error happens most.

But: A real doctor uses many tests, not just a 2×2 grid.

You see it every day

on your phone

Email spam check

AI guesses if emails are spam or real. The matrix shows how many real emails it blocked by mistake.

out in the world

Disease screening

AI finds sick patients from X-rays. The matrix shows which patients got missed or wrongly flagged.

at work

Job application AI

AI filters job applicants. The matrix shows how many good people got rejected by mistake.

Step by step

  1. 1

    Collect true answers

    You gather real data where you know the correct answer.

  2. 2

    Run the model

    The AI model makes a guess for each case.

  3. 3

    Compare both

    You put each guess next to the true answer.

  4. 4

    Fill the grid

    Count correct and wrong guesses in each of four boxes.

  5. 5

    Read the pattern

    Look at where most mistakes are to improve your AI.

Remember

Confusion matrix shows AI right and wrong guessesFour boxes compare what AI said vs. truthHelps you spot which type of error happensUsed to measure and improve any AI systemSimple tool that works for all AI problems

Memory trick

Think 2×2: Two choices (yes or no) and two sources (what AI said, what was true). Four boxes fill in order.

Words

confusion matrix con-FYOO-zhun MAY-triks
A table showing correct and wrong AI guesses in four boxes.
prediction pre-DIK-shun
What the AI guesses will happen based on patterns it learned.
model MAH-dul
The trained AI program that makes guesses.
accuracy AK-yuh-ruh-see
How many times the AI was right out of all tries.
true answer troo AHN-ser
The real, correct answer we already know is right.

Check yourself

quick check

What does a confusion matrix measure?

Hint

Think about what the name tells you.

quick check

A doctor AI screens patients for disease. True answer: healthy. AI guess: sick. Where does this go?

Hint

Does the truth match what AI said?

think

Why is it useful to see wrong guesses grouped in one place?

Show a good answer

You can see which mistake type the AI makes most. Then you can fix that problem to make the AI better.

Tell a friend

“A confusion matrix is a grid that shows where your AI was right and wrong. It helps you find which mistakes to fix.”

People also ask

Can I use a confusion matrix for any AI problem?

Yes. Any time AI makes yes-or-no guesses, you can use a matrix. It works for spam filters, medical tests, and hiring AI.

What if my AI has more than two possible answers?

The matrix grows bigger. A three-choice problem uses a 3×3 grid. But the idea stays the same: compare guesses to truth.

Does a perfect confusion matrix exist?

Yes, if all boxes on the diagonal are full and the others empty. But real AI almost never reaches perfection.