Machine Learning
Intermediate
4.5
Evaluate Classification Models
Go beyond accuracy with precision, recall, and the confusion matrix.
0h 25m
1 lesson
1.2K students
What You'll Learn
Learning objectives will be added soon.
Tutorial Content
Read the confusion matrix
from sklearn.metrics import classification_report, confusion_matrix
print(confusion_matrix(y_test, preds))
print(classification_report(y_test, preds))Which metric?
- Precision — trust of positive predictions (spam filters).
- Recall — coverage of actual positives (disease screening).
- F1 — balance of the two.
Threshold tuning
Classifiers output probabilities; the 0.5 cutoff is arbitrary. Adjusting it trades precision for recall — pick the point that matches the real-world cost of each error type.
Your Progress
Sign in to track your progress
Tags
Machine Learning
Evaluation
scikit-learn