S3-SA5-0446
What is a Confusion Matrix (Visualisation)?
Grade Level:
Class 10
AI/ML, Data Science, Physics, Economics, Cryptography, Computer Science, Engineering
Definition
What is it?
A Confusion Matrix is a special table that helps us see how well a prediction model performed, especially when classifying things into different groups. It shows us where the model got things right and where it got confused, by comparing its predictions with the actual correct answers.
Simple Example
Quick Example
Imagine you have a model that predicts if a cricket shot will be a 'Four' or 'Not a Four'. If the model predicts 'Four' and it actually was a 'Four', that's a correct prediction. If it predicts 'Four' but it was 'Not a Four', that's a mistake. A Confusion Matrix organises all these correct and incorrect predictions.
Worked Example
Step-by-Step
Let's say a model predicts if a student will pass or fail an exam. We test it on 100 students.
---
Step 1: Out of 60 students who actually passed, the model correctly predicted 50 would pass and incorrectly predicted 10 would fail.
---
Step 2: Out of 40 students who actually failed, the model correctly predicted 35 would fail and incorrectly predicted 5 would pass.
---
Step 3: Let's fill a Confusion Matrix:
| | Predicted Pass | Predicted Fail |
|-----------|----------------|----------------|
| Actual Pass | 50 | 10 |
| Actual Fail | 5 | 35 |
---
Step 4: From this, we see the model correctly predicted 50 actual passes and 35 actual fails. It made 10 errors predicting pass as fail, and 5 errors predicting fail as pass.
Answer: The Confusion Matrix shows 50 True Positives, 10 False Negatives, 5 False Positives, and 35 True Negatives.
Why It Matters
Understanding Confusion Matrices is crucial in AI/ML and Data Science to evaluate how good a model is. Engineers use it to fine-tune self-driving cars, and doctors use it to check the accuracy of disease diagnosis tools. Learning this helps you build smarter systems and make better decisions in many future careers.
Common Mistakes
MISTAKE: Confusing rows and columns, like putting 'Actual' on the top and 'Predicted' on the side. | CORRECTION: Always remember the standard layout: 'Actual' values are typically on the rows and 'Predicted' values are on the columns.
MISTAKE: Mixing up True Positives and True Negatives, or False Positives and False Negatives. | CORRECTION: True means the prediction matches the actual. Positive/Negative refers to the predicted class. So, True Positive = correctly predicted positive, False Negative = incorrectly predicted negative.
MISTAKE: Thinking a high number in any cell means the model is good. | CORRECTION: You need to look at all four cells together. A good model has high numbers in the 'True' cells (top-left and bottom-right) and low numbers in the 'False' cells (top-right and bottom-left).
Practice Questions
Try It Yourself
QUESTION: A model predicts if an email is 'Spam' or 'Not Spam'. It correctly identified 90 spam emails and 80 non-spam emails. It wrongly classified 5 non-spam emails as spam and 10 spam emails as non-spam. Create a Confusion Matrix. | ANSWER:
| | Predicted Spam | Predicted Not Spam |
|-----------|----------------|--------------------|
| Actual Spam | 90 | 10 |
| Actual Not Spam | 5 | 80 |
QUESTION: In the previous question, what are the True Positives and False Negatives if 'Spam' is considered the positive class? | ANSWER: True Positives = 90 (correctly identified spam). False Negatives = 10 (spam emails wrongly classified as not spam).
QUESTION: A model predicts if a transaction is 'Fraud' or 'Not Fraud'. Out of 1000 transactions, 50 were actual fraud. The model caught 45 of these frauds but also wrongly flagged 20 non-fraud transactions as fraud. Fill the Confusion Matrix and calculate the total number of correct predictions. | ANSWER:
| | Predicted Fraud | Predicted Not Fraud |
|-----------|-----------------|---------------------|
| Actual Fraud | 45 | 5 |
| Actual Not Fraud | 20 | 930 |
Total correct predictions = 45 + 930 = 975.
MCQ
Quick Quiz
Which of the following cells in a Confusion Matrix represents cases where the model predicted 'Positive' but the actual outcome was 'Negative'?
True Positive
False Positive
True Negative
False Negative
The Correct Answer Is:
B
False Positive means the model made a 'Positive' prediction (Positive) but it was wrong (False), meaning the actual outcome was 'Negative'.
Real World Connection
In the Real World
In Indian healthcare, Confusion Matrices are used to evaluate diagnostic tests. For example, a model predicting if a patient has dengue fever. Doctors can use the matrix to understand how often the test correctly identifies dengue (True Positive), misses it (False Negative), or wrongly says someone has it when they don't (False Positive), helping them make better treatment decisions.
Key Vocabulary
Key Terms
True Positive: Correctly predicted positive outcome | True Negative: Correctly predicted negative outcome | False Positive: Incorrectly predicted positive outcome (Type I error) | False Negative: Incorrectly predicted negative outcome (Type II error) | Classification Model: An AI model that categorises data into classes.
What's Next
What to Learn Next
Now that you understand Confusion Matrices, you can explore metrics like Accuracy, Precision, Recall, and F1-Score. These metrics are calculated directly from the Confusion Matrix cells and give you a more detailed understanding of model performance. Keep learning, you're building a strong foundation for AI!


