🎯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.