Confusion Matrix (TP, TN, FP, FN) Explained Simply for CBSE AI

⚡ Direct Answer & Key Takeaway

A confusion matrix is a 2x2 evaluation table used in CBSE AI (Code 417 Part B, 40 marks, and Code 843) to compare predicted outcomes against actual reality. It classifies test predictions into four outcomes: True Positive (TP: predicted Yes, actual Yes), True Negative (TN: predicted No, actual No), False Positive (FP: predicted Yes, actual No), and False Negative (FN: predicted No, actual Yes). Total evaluated cases always equal TP + TN + FP + FN.

1. Mapping Reality vs Prediction in the 2x2 Grid

In CBSE Class 10 AI Unit 7 (Evaluation) and Class 12 Code 843, examiners test whether students can read the rows and columns of a confusion matrix without swapping False Positives and False Negatives. Always read the axis labels before assigning cells, because some NCERT tables place Prediction on rows and Reality on columns, while scikit-learn places Reality on rows and Prediction on columns. First, identify the positive class—such as forest fire detected, spam email, or defective chip. Any cell where Prediction equals Reality is a 'True' outcome (TP or TN). Any cell where Prediction disagrees with Reality is a 'False' outcome (FP or FN). Notice that the second letter (P or N) always reflects what the model predicted, whereas 'True' or 'False' tells whether that prediction matched ground truth.

  • True Positive (TP): Prediction = Yes and Reality = Yes (correct positive alert).
  • True Negative (TN): Prediction = No and Reality = No (correct normal clearance).
  • False Positive (FP): Prediction = Yes but Reality = No (false alarm / Type I error).
  • False Negative (FN): Prediction = No but Reality = Yes (missed threat / Type II error).

2. Worked Board Case: Forest Fire Sensor Dataset

Consider a classic CBSE Part B (40 marks) scenario where an AI camera monitors 200 forest sector images for wildfires. Suppose 60 sectors actually have fires, and 140 sectors are safe. The model raises fire alerts for 50 actual fire sectors, misses 10 actual fire sectors, falsely triggers alarms on 15 safe sectors, and correctly clears 125 safe sectors. Writing these into the 2x2 grid gives TP = 50, FN = 10, FP = 15, and TN = 125. Summing all four quadrants checks arithmetic: 50 + 10 + 15 + 125 = 200 total images. Notice how the Actual Yes group sums to TP + FN = 60, while Actual No sums to FP + TN = 140. Verifying row and column totals prevents costly sign or cell-swap errors during board exams.

  • Check total count first: TP + TN + FP + FN must equal dataset size (200).
  • Actual Positives = TP + FN = 50 + 10 = 60 real wildfire cases.
  • Predicted Positives = TP + FP = 50 + 15 = 65 total alarms triggered.

3. CBSE Exam Marking Scheme and Practical Verification

In the CBSE AI assessment structure—Part A Employability Skills (10 marks), Part B Subject Specific Skills (40 marks), and Practical/Project work (50 marks)—Confusion Matrix questions appear in both 2-mark short answers and 4-mark competency case studies in Part B, plus Jupyter Notebook evaluations in the 50-mark Practical. Board marking schemes award step marks for correctly labeling axes, extracting TP, TN, FP, and FN values from a word problem, and verifying the sample sum before computing downstream metrics. In Python lab practicals, learners compare manual counting against scikit-learn's confusion_matrix or pure Python loops. Note that if you change which class is labeled '1' (positive), TP and TN swap places, and FP and FN swap places, so always state the positive class explicitly in your answer.

  • Always state which outcome (e.g., Disease = 1, Fire = 1) is the Positive class.
  • Verify whether Prediction is on the vertical or horizontal axis before reading values.
  • Show the 2x2 table clearly in Part B solutions to secure full step-marking credit.

4. Compute TP, TN, FP, FN from Ground Truth and Predictions

actual =    [1, 1, 1, 0, 0, 0, 1, 0, 1, 0]
predicted = [1, 0, 1, 1, 0, 0, 1, 0, 0, 0]

tp = sum(1 for a, p in zip(actual, predicted) if a == 1 and p == 1)
tn = sum(1 for a, p in zip(actual, predicted) if a == 0 and p == 0)
fp = sum(1 for a, p in zip(actual, predicted) if a == 0 and p == 1)
fn = sum(1 for a, p in zip(actual, predicted) if a == 1 and p == 0)

print(f"TP={tp}, TN={tn}, FP={fp}, FN={fn}, Total={tp + tn + fp + fn}")

Verified Console / Dry-Run Output:

TP=3, TN=4, FP=1, FN=2, Total=10

5. Confusion Matrix Outcomes Across CBSE Case Scenarios

Case ScenarioPredicted vs ActualCell LabelReal-World Meaning
Wildfire Alert (Positive = Fire)Pred: Yes | Actual: YesTrue Positive (TP)Fire exists and siren correctly triggers
Wildfire Alert (Positive = Fire)Pred: No | Actual: NoTrue Negative (TN)Forest is safe and system stays quiet
Wildfire Alert (Positive = Fire)Pred: Yes | Actual: NoFalse Positive (FP)False alarm wastes emergency dispatch
Wildfire Alert (Positive = Fire)Pred: No | Actual: YesFalse Negative (FN)Real wildfire goes undetected (critical risk)
🎯 1-on-1 Live Mentorship & Free Study Kit

Master CBSE AI Evaluation Step-by-Step

Practice Code 417 & 843 confusion matrix case studies and Python labs with 4Achievers Junior in 1-on-1 or 1:4 Micro-Pods.

💬 WhatsApp Now
🔒 Instant WhatsApp notes + free 60-min 1-on-1 trial session
Confirmed! Our Senior Mentor is sending your study kit & free 1-on-1 demo link on WhatsApp now.

6. Common Mistakes & Top Scorer Tips

  • Avoid Mistake: Swapping FP and FN because of ignoring whether rows represent Prediction or Reality.
  • Avoid Mistake: Forgetting that the second letter (P or N) comes from the model's prediction, not ground truth.
  • Avoid Mistake: Skipping the sanity check that TP + TN + FP + FN equals the total test cases given.
  • Examiner / Mentor Tip: In Part B 4-mark case studies, draw the 2x2 grid with explicit 'Prediction' and 'Reality' labels first.
  • Examiner / Mentor Tip: Remember the mnemonic: second word = Prediction (Positive/Negative); first word = did it match Reality (True/False)?
  • Examiner / Mentor Tip: For the 50-mark Practical viva, know why scikit-learn places actual labels on rows and predicted labels on columns.

7. Interactive Concept Check Quiz

Question: An AI quality-control camera checks 100 circuit boards (Positive = Defective). 20 boards are truly defective, and the model flags 16 of them plus 5 healthy boards as defective. What are FP and FN?

8. Frequently Asked Questions

Does CBSE NCERT put Prediction on rows or columns in a confusion matrix?
CBSE Class 10 Code 417 study material typically places Reality across columns (Yes/No) and Prediction down rows (Yes/No), whereas Python's scikit-learn places Reality on rows. Always check the axis titles in the question paper.
Can a confusion matrix have more than four cells?
Yes. For binary classification (2 classes), it is 2x2 (4 cells: TP, TN, FP, FN). For multi-class classification with K classes (common in Class 12 Code 843 projects), it becomes a KxK grid.
Why is a confusion matrix better than looking at total correct predictions alone?
Total correct count (TP + TN) hides whether errors come from false alarms (FP) or missed detections (FN), which carry completely different real-world consequences.

Explore Related Lessons & Free Interactive Tools

Free 1-on-1 Session

Book a Free Demo Class