Course contentsShow
← Machine Learning and Deep Learning
Lesson 451 of 3,53811. Model Evaluation MetricsFree lesson

Confusion Matrix Fundamentals

Understanding true positives, false positives, true negatives, and false negatives as the foundation of classification metrics.

Confusion Matrix Fundamentals

What you'll learn: How to understand the four basic building blocks that measure classification model performance.

What Is a Confusion Matrix?

A confusion matrix is a simple table that helps you see exactly where your classification model is getting things right and where it's getting confused. Think of it like a report card that breaks down your model's predictions into four distinct categories.

The Four Core Components

Imagine you're building a model to detect spam emails. For every email, your model makes a prediction (spam or not spam), and reality tells us what the email actually was. This creates four possible outcomes:

True Positives (TP)

The model correctly identified spam as spam. The prediction was "positive" (spam), and it was true.

True Negatives (TN)

The model correctly identified normal emails as not spam. The prediction was "negative" (not spam), and it was true.

False Positives (FP)

The model incorrectly flagged a normal email as spam. The prediction was "positive" (spam), but it was false. Also called a "Type I error" or "false alarm."

False Negatives (FN)

The model missed actual spam, letting it through as normal. The prediction was "negative" (not spam), but it was false. Also called a "Type II error" or "miss."

Why This Matters

These four numbers form the foundation for every classification metric you'll encounter. Precision, recall, F1-score, accuracy—they're all just different ways of combining these four values to answer specific questions about your model's performance.

Key Takeaway: The confusion matrix breaks down classification results into four fundamental categories—true positives, true negatives, false positives, and false negatives—which form the basis for all classification evaluation metrics.