← AI Terminology
Class Imbalance
Class imbalance occurs when some labels are much rarer than others, so naive accuracy is misleading and learners bias toward majority classes.
Ubiquitous in fraud, disease, spam, and rare-event prediction.
Ubiquitous in fraud, disease, spam, and rare-event prediction.
Why It Matters in AI
Real rare events matter most. Without imbalance handling (resampling, class weights, focal loss, careful metrics), models look accurate while missing the minority class. Essential classification literacy.
Key Points
| Aspect | Description |
|---|---|
| LLM | Rare safety categories need upsampling too |
| Data | Collect more minority cases; careful augmentation |
| Methods | Class weights, over/under-sampling, SMOTE, focal loss |
| Metrics | PR-AUC, F1, recall@precision constraints |
| Problem | 99% accuracy by always predicting majority |
| Related | Precision/recall, anomaly detection |
Simple Analogy
Training a lifeguard only on sunny calm days then testing on rare riptide rescues — majority weather dominates unless you rebalance practice.
Common Usage Examples
class_weight='balanced'in sklearn- Report PR curves not only accuracy
- SMOTE on training folds only
- Threshold tuning for business recall
Summary
In short: Class imbalance skews labels toward common classes — demanding special metrics and training strategies so rare events are not ignored.