1. How do you handle class imbalance in classification?
Resampling (SMOTE/undersample), class weights, threshold tuning, PR-AUC over accuracy.
Machine learning interview questions for data roles range from bias-variance and evaluation through to model and system design. Real ML questions asked for data-science and ML-engineering loops, with worked answers below.
Resampling (SMOTE/undersample), class weights, threshold tuning, PR-AUC over accuracy.
L1 (Lasso) drives weights to zero for sparsity and selection, L2 (Ridge) shrinks weights smoothly.
Precision, recall, PR-AUC and F-beta. Avoid raw accuracy, and consider cost-weighted metrics.
Bagged decision trees with feature subsampling, averaged or voted to reduce variance.
Split data into k folds to estimate generalization robustly and use all data for validation.
Check for features that use future or target information, fit transforms only on the training set, and audit unrealistically high scores.
Precision is the share of predicted positives that are correct, recall is the share of actual positives that were caught.
Boosting fits trees sequentially on residuals to reduce bias, bagging trains them independently to reduce variance.
Elbow method, silhouette score, gap statistic, or domain knowledge.
Model treatment effect (T-learner/uplift trees) using randomized/quasi-experimental data.