Class 10 AI Unit 3: Evaluating Models – Notes (Confusion Matrix, Precision, Recall, F1) | CBSE Code 417

Class 10 · AI (417) · Part B · Unit 3
Evaluating Models

How do we know if an AI model is actually good? Train-test split, accuracy, error, the confusion matrix, precision, recall and F1 score.

10 Marks (Theory)21 hrs Theory + 4 hrs PracticalNumericals Asked
In this chapter
  1. Why evaluate a model?
  2. Train-test split
  3. Accuracy and error
  4. Confusion matrix
  5. Precision, recall and F1 score
  6. Ethical concerns in evaluation
📖 Think about your pre-boards

Your teacher doesn't give you the exact same questions in the pre-board that you practised in class. Why? Because if you just memorised those answers, you'd score 100% without really understanding anything. A new paper shows whether you actually learned. AI models are tested the same way: on data they have never seen.

1. What is Model Evaluation?

🔑 Definition

Model evaluation is the process of checking how well an AI model performs, using metrics like accuracy, precision and recall. It tells us the model's strengths and weaknesses so we can improve it before real people start depending on it.

Why it matters: it tells us whether the model is reliable, helps us compare models and pick the best one, and catches problems like bias before deployment.

2. Train-Test Split

We divide the dataset into two parts: most of it for training, the rest kept aside for testing. A common split is 80:20 or 70:30.

Full dataset (1000 rows) Training: 800 rows (80%) Test: 200 model learns from this model is checked on this
⚠️ Why not test on training data?

The model has already seen that data, so it will "remember" the answers and look perfect. This is called overfitting: great on old data, poor on new data. Just like memorising last year's paper.

3. Accuracy and Error

When a model predicts a number, we measure how far off it was:

TermFormula
Error| Actual value − Predicted value |
Error rateError ÷ Actual value
Accuracy1 − Error rate
Accuracy %Accuracy × 100
🧮 Solved example

A model predicts a flat costs ₹45 lakh. The actual price is ₹50 lakh.
Error = |50 − 45| = 5 · Error rate = 5 ÷ 50 = 0.1 · Accuracy = 1 − 0.1 = 0.9 → 90%

When a model predicts a category (yes/no), accuracy is simply: Accuracy = Correct predictions ÷ Total predictions × 100.

4. The Confusion Matrix

📖 Meet the forest fire alarm

An AI watches a forest and predicts "Fire" or "No fire". It can be right in two ways and wrong in two ways. A confusion matrix is just a 2×2 table that counts all four.

ACTUAL (Reality) Yes (Fire) No (No fire) PREDICTED (AI) Yes No TPSaid fire, was fire ✔ FPSaid fire, no fire ✘ FNSaid no fire, was fire ✘ TNSaid no fire, no fire ✔
Green = the AI was right. Red = the AI was wrong.
✅ Memory trick

Read it backwards. The second letter (P/N) is what the AI predicted. The first letter (T/F) says whether that prediction was True or False. So FN = predicted Negative, and that was False → there actually was a fire.

5. Precision, Recall and F1 Score

MetricFormulaQuestion it answers
Accuracy(TP + TN) ÷ TotalHow often is the model right overall?
PrecisionTP ÷ (TP + FP)When it says "Yes", how often is it correct?
RecallTP ÷ (TP + FN)Of all the real "Yes" cases, how many did it catch?
F1 Score2 × P × R ÷ (P + R)A balance of precision and recall.
🧮 Fully solved numerical

The fire model was tested on 200 days: TP = 40, FP = 10, FN = 20, TN = 130.

Accuracy = (40 + 130) ÷ 200 = 170 ÷ 200 = 85%
Precision = 40 ÷ (40 + 10) = 40 ÷ 50 = 0.80
Recall = 40 ÷ (40 + 20) = 40 ÷ 60 = 0.67
F1 = 2 × 0.80 × 0.67 ÷ (0.80 + 0.67) ≈ 0.73

What it means: 85% sounds great, but recall is only 0.67. The model missed 20 real fires. For a fire alarm, that's dangerous.

AccuracyPrecisionRecallF1 Score 0.850.800.670.73

Which metric matters when?

🔥

Use Recall when FN is costly

Missing a real case is dangerous: forest fire, cancer screening, COVID test. We'd rather have a few false alarms than miss one real case.

📧

Use Precision when FP is costly

A wrong "yes" hurts: spam filter sending your admit card email to spam, or an app wrongly flagging an honest bank transaction as fraud.

⚖️

Use F1 when both matter

When you need a balance, and especially when one class is much rarer than the other.

6. Ethical Concerns in Evaluation

⚖️

Bias

If test data doesn't include all groups (e.g., only city students), the model may look accurate but fail others.

🔍

Transparency

People should know how the model was evaluated and why it made a decision.

🎯

Accuracy

Report honest results. Don't hide low recall behind a high accuracy number.

✏️
Try this with your friends: ask 10 classmates to guess whether it'll rain tomorrow. The next day, fill a confusion matrix with their guesses and calculate everyone's accuracy. Who had the best recall?

Quick Check

Q1. TP = 30, FP = 10. Find precision.

30 ÷ 40 = 0.75

Q2. TP = 30, FN = 20. Find recall.

30 ÷ 50 = 0.6

Q3. A cancer test should have high precision or high recall?

High recall — missing a patient (FN) is dangerous.

Q4. Actual = 200, predicted = 180. Find accuracy %.

Error = 20, error rate = 0.1, accuracy = 0.9 → 90%

⚡ One-minute revision

  • Evaluate on unseen test data (train-test split, e.g., 80:20).
  • Error = |Actual − Predicted|; Accuracy = 1 − Error ÷ Actual.
  • Confusion matrix: TP, FP, FN, TN.
  • Accuracy = (TP+TN)/Total · Precision = TP/(TP+FP) · Recall = TP/(TP+FN) · F1 = 2PR/(P+R).
  • FN costly → Recall. FP costly → Precision. Both → F1.
  • Ethics: bias, transparency, accuracy.

Done reading? Test yourself on AI Unit 3 in board-exam style.

📝 Take the Practice PaperNext: AI Unit 4 ›🏠 Class 10 Hub

Comments

🧭 Explore AI Topics

Keep learning with our topic guides for CBSE AI (Classes 6–12).

🔄 AI Project Cycle🐍 Python for AI🤖 Machine Learning💬 NLP👁️ Computer Vision⚖️ AI Ethics