Data Science Interview Q&A
Master your next technical interview with these high-frequency Data Science and AI architectural questions compiled by top tier tech instructors.
What is the difference between bagging and boosting algorithms?
Bagging (Bootstrap Aggregating) runs models in parallel on bootstrapped subsets of data. It aims to reduce variance (overfitting) by averaging results (e.g., Random Forest).
Boosting runs models sequentially. Each new model focuses on correcting the errors made by previous models, aiming to reduce bias (e.g., XGBoost, Gradient Boosting).
How do you handle class imbalance in machine learning datasets?
Class imbalance can be addressed through several strategies:
- Resampling: Oversampling the minority class (e.g., SMOTE) or undersampling the majority class.
- Algorithmic adjustments: Using class-weighted loss functions to penalize minority misclassifications heavier.
- Metrics Selection: Focusing on Precision, Recall, F1-Score, or ROC-AUC instead of raw accuracy.
Explain the vanishing gradient problem in deep neural networks.
The vanishing gradient problem occurs during backpropagation when gradients are scaled down multiplicatively by small values as they propagate backward through layers. This causes weights in early layers to update very slowly or not at all, hindering training.
Solutions: Using non-saturating activation functions (like ReLU), implementing residual connections (ResNets), or using batch normalization.