Data Preparation and Class Imbalance for ML Questions

Preparing training data and handling skewed or shifting distributions. Covers preprocessing and cleaning for model input, data augmentation, distribution shift, class imbalance techniques (resampling, reweighting, threshold tuning), and cold-start scenarios where labeled data is scarce. Focuses on the data-side decisions that determine whether a model can learn at all.

MediumTechnical
50 practiced

You are designing a training pipeline that combines undersampling of the majority class with class-weighted loss for a tree-based model. Is combining the two a good idea, and if so what order of operations avoids double-correcting for imbalance? Explain the validation strategy you would use to catch leakage and the pitfalls of over-compensating.

MediumTechnical
44 practiced

Should you add a binary 'was missing' indicator column alongside an imputed value, rather than just imputing silently? Discuss the advantages and pitfalls, in which situations it improves predictive performance and interpretability, and propose an experiment to test whether missingness itself is informative for your specific dataset.

MediumTechnical
41 practiced

Explain when to use one-hot encoding versus ordinal/label encoding for a categorical variable, and how the choice affects different model families (linear models, tree ensembles, distance-based models). Then implement a simple label encoder that maps unseen categories at inference time to a reserved token, and make it serializable.

MediumTechnical
40 practiced

Build a reproducible scikit-learn preprocessing pipeline using ColumnTransformer and Pipeline: impute numeric columns with the median, impute categorical columns with a placeholder value, one-hot encode the categoricals, and scale the numeric features with StandardScaler. Fit it on the training data and correctly apply it to validation and test data, and explain exactly why this structure prevents data leakage during cross-validation.

MediumTechnical
48 practiced

How do you detect multicollinearity in a feature set, and what practical steps can you take to address it before building a predictive model? Discuss correlation matrices, the Variance Inflation Factor, PCA, removing or combining correlated features, and using a regularized model instead, and note the implications each remedy has for interpretability.

Unlock Full Question Bank

Get access to all Data Preparation and Class Imbalance for ML interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.