Rebalancing
Techniques for ensuring models pay adequate attention to rare classes during training
Intent & Description
π― Intent
Address class imbalance where the class that matters most is also the rarest, preventing models from trivially favoring the majority class while performing poorly on the minority class.
π Context
Many real classification problems are naturally imbalanced (fraud, rare disease detection, manufacturing defects). Training on the natural distribution often makes models favor the majority class and perform poorly on the minority class the system exists to catch.
π‘ Solution
Use techniques to ensure the model pays adequate attention to the rare class: downsampling the majority class, oversampling or synthetically generating minority-class examples, or weighting the loss function so misclassifying the minority class costs more. Evaluate correctly afterward with appropriate metrics.
Real-world Use Case
- Fraud detection where fraud is rare but costly
- Rare disease detection in medical screening
- Manufacturing defect detection
- Any classification problem with meaningful imbalance
Source
π TL;DR
Use downsampling, oversampling, or class weighting to ensure models learn from rare classes, then evaluate with appropriate metrics like precision, recall, and PR-AUC
Advantages
- Ensures model learns from minority class examples
- Improves performance on the class that matters most
- Multiple techniques available (downsampling, oversampling, weighting)
- Enables use of appropriate evaluation metrics
Disadvantages
- Risk of overfitting to resampled minority data
- Probability outputs may need recalibration
- Over-sampling can lead to overfitting on duplicates
- Requires careful validation set handling