Back to Classic ML Mind Map
中文·English
📊 Classic MLID: data-imbalance

Class Imbalance

类别不平衡
🎯Core Definition
Class imbalance means highly skewed class ratios (e.g. 1:1000). Problem and impact: the model favors the majority class and the decision boundary is dragged toward the minority; accuracy becomes meaningless — predicting the majority class always yields 99.9% accuracy while minority recall collapses toward zero, yet the business value lives in the minority (fraud, disease). Metric choice: when the minority class matters, PR curves / PR-AUC beat ROC — ROC's FPR denominator contains a huge number of true negatives that dilute the curve into over-optimism, whereas PR directly captures the precision-recall (minority) tradeoff; pair with F1, F-beta and PR-AUC. The solution map has four layers: data (SMOTE oversampling, undersampling, synthetic data), algorithm (class weights / cost-sensitive loss, Focal Loss), metrics (PR, F1, PR-AUC), and decision (threshold moving).
💡Use Cases
fraud detection, anomaly detection, rare-disease diagnosis, low-conversion ads — tasks at 1:100 or even 1:10000 ratios; interviews always ask “how to handle a 1:100 ratio” and “why not look at accuracy”.
Key Problems Solved
naive training makes the model lazily predict the majority class, yielding high accuracy but zero utility; the correct order is to fix the metric first (PR over ROC), then intervene at the data, algorithm and decision layers (resampling + weighted loss + threshold moving) to pull minority recall back to a business-usable level.
🎯5 High-Frequency Exam Points
1
Why does PR beat ROC under class imbalance? How does the huge true-negative denominator dilute FPR and thus ROC?
2
Positive:negative = 1:1000, 99.9% accuracy, but business needs high recall: what are your steps (metric → method → validation)?
3
How does class weight (cost-sensitive learning) work? Is it mathematically equivalent to oversampling?
4
How do you move the decision threshold? How does it relate to resampling and weighted loss?
5
Under imbalance, which reflects business better, F1 or AUC? When is AUC still fine?
Updated 2026-08-12
🎯
Test Your Knowledge: Practice Questions for "Class Imbalance"
Single choice pitfall questions with instant feedback and mistake tracking.
🚀 Start Card Practice
Previous CardTime-Series Cross-ValidationNext CardResampling Methods: SMOTE/ADASYN/Tomek

🔗 More Classic ML Knowledge Cards

AdaBoost DerivationBagging & Random ForestBaum-Welch (HMM EM)GBDT Negative Gradient