Machine Learning
Intermediate
4.5
Handling Imbalanced Datasets
When 99% of examples are one class, accuracy lies.
0h 25m
1 lesson
1.2K students
What You'll Learn
Learning objectives will be added soon.
Tutorial Content
The trap
Fraud, disease, and defects are rare. A model can score 99% accuracy by always predicting "normal" — and catch nothing useful.
What to do
- Pick the right metric — precision/recall/F1, not accuracy.
- Resample — oversample the minority (SMOTE) or undersample the majority.
- Class weights — tell the model to penalize minority errors more.
- Adjust the threshold to favor recall where misses are costly.
Mindset
Define which error is more expensive before training, then optimize for it. Imbalance is a framing problem as much as a modeling one.
Your Progress
Sign in to track your progress
Tags
Machine Learning
Evaluation
Data Science