Data Science · Chapter 26 of 43
Model Evaluation
Pick a metric that matches the BUSINESS COST of errors. Report multiple metrics — a single number always hides something.
Always compare to a baseline (simple rule, majority class, previous model).
Example 1 (python)
from sklearn.metrics import classification_report
print(classification_report(y_test, y_pred))Output
precision recall f1-score support...Precision, recall, F1 per class.
Example 2 (python)
from sklearn.metrics import mean_absolute_error, r2_score
print(mean_absolute_error(y_true, y_pred), r2_score(y_true, y_pred))Output
3.4 0.82Regression metrics.
Key points
- Pick metrics that match business cost.
- Always report a baseline.
- Confusion matrix for classification.
- MAE/RMSE/R² for regression.
💡 Note: A '95% accurate' model on 95%-negative data may be predicting 'negative' every time. Always check per-class metrics.
