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
54 practiced

What are the trade-offs between storing intermediate preprocessing artifacts (cleaned tables, tokenized text, computed embeddings) versus recomputing transforms on the fly, for both training and serving? Discuss cost, reproducibility, storage, and latency, and give a rule of thumb for when to materialize versus compute at request time.

MediumTechnical
40 practiced

What is data leakage in the preprocessing context, and why must scalers, encoders, and imputers be fit on the training fold only, never on the full dataset before splitting? Give two concrete examples of leakage (one with a numeric transform, one with a feature derived from information that would not exist at prediction time, like a 'days to cancel' field when predicting churn), and show how to structure a scikit-learn Pipeline plus ColumnTransformer so that computing statistics on the whole dataset before cross-validation becomes structurally impossible.

MediumTechnical
43 practiced

Describe 'smart' or informed undersampling techniques: Tomek links, Edited Nearest Neighbors (ENN), and NearMiss. Explain how they differ from random undersampling, their typical use cases and effect on class-boundary cleanliness, and how you would validate that an undersampling strategy did not remove important majority-class structure.

EasyTechnical
49 practiced

Compare oversampling the minority class and undersampling the majority class: define each, list their advantages and disadvantages (information loss, overfitting risk, training speed), and give a rule of thumb for choosing between them based on dataset size. Mention when a hybrid such as SMOTE plus Tomek-link cleaning is worth the extra complexity.

HardTechnical
39 practiced

You inherit a training pipeline that applies SMOTE before splitting the data into train and test sets. Training AUC is 0.98, validation AUC is 0.75, and minority-class recall keeps declining once the model reaches production. Walk through a debugging plan: what specific checks would you run (leakage, order of operations, SMOTE parameterization, neighbor analysis), what experiments would you run to compare alternatives, and what is your short-term versus long-term remediation plan?

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.