FREE Live Master Session: Code Your AI Companion for Kids

    Register for Free →
    HomeClass 10 AI HubUnit 3: Evaluating Models
    Part B • Unit 310 Marks Theory25 Total Hours (21 Theory + 4 Practical)

    Unit 3: Evaluating Models & Confusion Matrix

    Complete study notes, Train-Test split methods, Overfitting intuition, Confusion Matrix (TP, TN, FP, FN), and step-by-step calculation formulas for Accuracy, Precision, Recall, and F1-Score with all official CBSE case studies.

    Section 3.1 & 3.2

    Importance of Model Evaluation & Train-Test Split

    In the AI project cycle, after Problem Scoping, Data Acquisition, Data Exploration, and Modelling, Model Evaluation is like issuing a school report card to your algorithm. It provides constructive feedback to identify strengths, weaknesses, and suitability before deploying the AI in real life.

    The Train-Test Split Method

    The dataset is divided into two distinct subsets:

    • Training Dataset (Typically 70% to 80%): Used by the algorithm to adjust weights and learn patterns.
    • Testing Dataset (Typically 20% to 30%): Completely unseen data fed to the model to assess its generalisation capability.

    Why Not Test on Training Data? (Overfitting)

    If an AI model is evaluated on the exact same data it was trained on, it simply memorizes all data points without understanding the underlying logic. This phenomenon is called Overfitting. The model achieves 100% training accuracy but fails completely when deployed in the real world.

    Section 3.3

    Accuracy vs Error: Formulas & Numerical Calculations

    Pillar 1

    Absolute Error

    |Actual − Predicted|

    Quantifies difference without sign

    Pillar 2

    Error Rate

    Error / Actual

    Relative error as a fraction

    Pillar 3

    Accuracy %

    (1 − Error Rate) × 100%

    Proportion of correct estimation

    Handbook Activity 1: House Price Prediction Accuracy Table (Page 66)

    PredictedActualAbs ErrorError RateAccuracyAccuracy %
    391k402k11k11/402 = 0.0271 - 0.027 = 0.97397.3%
    453k488k35k35/488 = 0.0721 - 0.072 = 0.92892.8%
    125k97k28k28/97 = 0.2891 - 0.289 = 0.71171.1%
    871k907k36k36/907 = 0.0401 - 0.040 = 0.96096.0%
    322k425k103k103/425 = 0.2421 - 0.242 = 0.75875.8%
    Overall Model Mean Accuracy:86.6%
    Section 3.4

    The Confusion Matrix & Classification Metrics

    A Confusion Matrix is a 2×2 contingency table presenting the actual ground-truth values against the predicted outcomes generated by a classification model:

    Pred: YES (1)
    Pred: NO (0)
    Act: YES (1)
    True Positive (TP)Correctly predicted YES
    False Negative (FN)Wrongly predicted NO
    Act: NO (0)
    False Positive (FP)Wrongly predicted YES
    True Negative (TN)Correctly predicted NO
    Metric 1

    Classification Accuracy

    Accuracy = (TP + TN) / (TP + TN + FP + FN)

    Ratio of total correct predictions out of all predictions made.

    Metric 2

    Precision (When FP is costly)

    Precision = TP / (TP + FP)

    Measures accuracy of positive predictions. Crucial for Rocket Launch weather & Email Spam detection.

    Metric 3

    Recall / Sensitivity (When FN is dangerous)

    Recall = TP / (TP + FN)

    Measures proportion of actual positives correctly caught. Vital for Cancer / COVID-19 diagnosis & Fraud detection.

    Metric 4

    F1-Score (Harmonic Mean)

    F1 = 2 × (Precision × Recall) / (Precision + Recall)

    Harmonizes precision and recall for unbalanced datasets where both false positives and false negatives matter.

    Official Handbook Lesson: Why Accuracy Fails on Unbalanced Data (Page 75–76)

    The 90% Accuracy Faulty Model Paradox

    Imagine testing 1000 students where 900 pass (Yes) and 100 fail (No). A completely broken “lazy” model predicts “Yes” for all 1000 students without looking at any data!

    $TP = 900, FN = 0, FP = 100, TN = 0$

    $Accuracy = (900 + 0) / (900 + 0 + 100 + 0) = 900 / 1000 = 90\%$

    Despite doing zero learning, the model claims 90% accuracy! But its Recall on failing students is 0%!

    Official Practice

    Test Yourself: Official MCQs & Answer Key

    Directly from Pages 81–83 of the Facilitator Handbook with official answers from Page 181. Click an option to test your knowledge!

    Q1. In a medical test for a rare disease, out of 1000 people tested, 50 actually have the disease while 950 do not. The test correctly identifies 40 out of the 50 people with the disease as positive, but it also wrongly identifies 30 of the healthy individuals as positive. What is the accuracy of the test?

    Q2. A student solved 90 out of 100 questions correctly in a multiple-choice exam. What is the error rate of the student's answers?

    Q3. In a spam email detection system, out of 1000 emails received, 300 are spam. The system correctly identifies 240 spam emails as spam, but it also marks 60 legitimate emails as spam. What is the precision of the system?

    Q4. In a binary classification problem, a model predicts 70 instances as positive out of which 50 are actually positive. What is the precision/recall of the model?

    Q5. In a sentiment analysis task, a model correctly predicts 120 positive sentiments out of 200 positive instances. However, it also incorrectly predicts 40 negative sentiments as positive. What is the F1 score of the model?

    Q6. A medical diagnostic test is designed to detect a certain disease. Out of 1000 people tested, 100 have the disease, and the test identifies 90 of them correctly. However, it also wrongly identifies 50 healthy people as having the disease. What is the precision of the test?

    Q7. A teacher's marks prediction system predicts the marks of a student as 75, but the actual marks obtained by the student are 80. What is the absolute error in the prediction?

    Q8. The goal when evaluating an AI model is to:

    Q9. A high F1 score generally suggests:

    Q10. How is the relationship between model performance and accuracy described?

    Official Solved Numericals

    Complete Numerical Case Studies (Pages 84–85)

    Step-by-step Confusion Matrix calculations for Accuracy, Precision, Recall, and F1-Score.

    Case Study 1: Spam Email Detection System (1000 Emails)

    Data: TP = 150 (spam correctly caught), FP = 50 (ham mislabeled as spam), TN = 750 (ham correctly caught), FN = 50 (spam missed).

    Accuracy: (150+750)/1000 = 90.0%
    Precision: 150/(150+50) = 75.0%
    Recall: 150/(150+50) = 75.0%
    F1: 2*(0.75*0.75)/1.5 = 0.75

    Case Study 2: Credit Loan Default Prediction (1000 Applicants)

    Data: TP = 90 (defaulters caught), FP = 40 (non-defaulters blocked), TN = 820 (good loans), FN = 50 (defaulters missed).

    Accuracy: (90+820)/1000 = 91.0%
    Precision: 90/(90+40) = 69.23%
    Recall: 90/(90+50) = 64.29%
    F1: 2*(0.6923*0.6429)/1.335 = 0.667

    Case Study 3: Fraudulent Transaction Classifier (1000 Transactions)

    Data: TP = 80 (fraud caught), FP = 30 (legit flagged), TN = 850 (legit clear), FN = 40 (fraud missed).

    Accuracy: (80+850)/1000 = 93.0%
    Precision: 80/(80+30) = 72.73%
    Recall: 80/(80+40) = 66.67%
    F1: 2*(0.7273*0.6667)/1.394 = 0.696

    Case Study 4: Disease Diagnosis Diagnostic Test (1000 Patients)

    Data: TP = 120 (sick detected), FP = 20 (healthy false alarm), TN = 800 (healthy confirmed), FN = 60 (sick missed).

    Accuracy: (120+800)/1000 = 92.0%
    Precision: 120/(120+20) = 85.71%
    Recall: 120/(120+60) = 66.67%
    F1: 2*(0.8571*0.6667)/1.524 = 0.750

    Case Study 5: Inventory Stockout Prediction (1000 Products)

    Data: TP = 100 (out-of-stock predicted), FP = 50 (in-stock predicted out), TN = 800 (in-stock), FN = 50 (out-of-stock missed).

    Accuracy: (100+800)/1000 = 90.0%
    Precision: 100/(100+50) = 66.67%
    Recall: 100/(100+50) = 66.67%
    F1: 2*(0.6667*0.6667)/1.333 = 0.667
    Fast Revision Summary

    Unit 3 Key Formulas & Decision Rules

    Accuracy: $(TP + TN) / \text{Total}$. Use only for balanced datasets.
    Precision: $TP / (TP + FP)$. Prioritize when False Positives are intolerable (Satellite launches, spam).
    Recall: $TP / (TP + FN)$. Prioritize when False Negatives are dangerous (Disease diagnosis, fraud).
    F1-Score: $2 imes (P imes R) / (P + R)$. Harmonic mean balancing both metrics.

    Frequently Asked Questions

    🎓 Live 1-on-1 Classes

    Book a Free Demo Class

    Score 100% in Class 10 AI evaluation numericals! Master Confusion Matrices, Precision, Recall, and F1 calculations with expert teachers.