🤖 Machine Learning / AI
Intermediate
What is class imbalance and how do you handle it?
Answer
Class imbalance occurs when one class has significantly more samples than others — common in fraud detection, medical diagnosis, and anomaly detection. Strategies: Resampling — over-sample the minority class (SMOTE creates synthetic examples) or under-sample the majority class. Class weights — give higher loss penalty to minority class mistakes. Threshold tuning — adjust the decision threshold for the positive class. Specialized metrics — use F1, AUC-PR (Precision-Recall AUC), or MCC instead of accuracy. Ensemble methods — BalancedRandomForest, EasyEnsemble.
More Machine Learning / AI Questions
View all →- Intermediate What is a convolutional neural network (CNN)?
- Intermediate What is a Recurrent Neural Network (RNN)?
- Intermediate What is an LSTM and how does it solve the vanishing gradient problem?
- Intermediate What is the attention mechanism in neural networks?
- Intermediate What is the Transformer architecture?