Sure! Let's look at the key evaluation metrics used in classification models, when to use them, and simple examples to understand each.
🎯 Problem: Predicting if a student will pass or fail an exam.
We have a model that predicts "Pass" or "Fail". After testing on 100 students, we get this confusion matrix:
| Predicted: Pass | Predicted: Fail |
|---|
| Actual: Pass | 40 (TP) | 10 (FN) |
| Actual: Fail | 5 (FP) | 45 (TN) |
Now, let’s look at the important metrics, what they mean, and when to use them.
1. Accuracy
What? Overall correctness: How often is the model right?
Formula:
(TP + TN) / Total = (40 + 45) / 100 = 85%
✅ Use when: Classes are balanced (similar number of passes and fails).
❌ Don’t use when: One class is rare (e.g., disease detection).
Example: If 95 students pass and only 5 fail, a model that always says "Pass" gets 95% accuracy but is useless.
✅ Good here? Yes — classes are balanced.
2. Precision
What? Of all students predicted to pass, how many actually passed?
Formula:
TP / (TP + FP) = 40 / (40 + 5) ≈ 88.9%
✅ Use when: You care about false alarms.
Example: You're giving scholarships — you don’t want to give it to someone who will fail (FP).
So, high precision means you’re confident that students predicted to pass really will.
3. Recall (Sensitivity)