Class 10 AI Unit 3: Evaluating Models – Notes (Confusion Matrix, Precision, Recall, F1) | CBSE Code 417
How do we know if an AI model is actually good? Train-test split, accuracy, error, the confusion matrix, precision, recall and F1 score.
- Why evaluate a model?
- Train-test split
- Accuracy and error
- Confusion matrix
- Precision, recall and F1 score
- Ethical concerns in evaluation
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?
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.
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:
| Term | Formula |
|---|---|
| Error | | Actual value − Predicted value | |
| Error rate | Error ÷ Actual value |
| Accuracy | 1 − Error rate |
| Accuracy % | Accuracy × 100 |
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
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.
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
| Metric | Formula | Question it answers |
|---|---|---|
| Accuracy | (TP + TN) ÷ Total | How often is the model right overall? |
| Precision | TP ÷ (TP + FP) | When it says "Yes", how often is it correct? |
| Recall | TP ÷ (TP + FN) | Of all the real "Yes" cases, how many did it catch? |
| F1 Score | 2 × P × R ÷ (P + R) | A balance of precision and recall. |
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.
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.
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
Post a Comment