Model Evaluation Metrics
Machine Learning · Intermediate
Definition
Metrics measure model quality: accuracy, precision, recall, F1 and ROC-AUC for classification; MSE and R² for regression.
The right metric decides whether a model is truly useful.
Diagram
Flowchart
Example: Precision & recall
tp, fp, fn = 8, 2, 4
p = tp/(tp+fp); r = tp/(tp+fn)
print(round(p,2), round(r,2), round(2*p*r/(p+r),2))Output: 0.8 0.67 0.73
Key points
- Accuracy misleads on imbalanced data
- Recall matters for disease detection
- Precision matters for spam filters
Interview questions
When to prefer recall?
When missing a positive is costly, e.g. cancer screening.