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.
Explain the purpose of splitting data into training, validation, and test sets, and give recommended split ratios for typical supervised tasks (and how those ratios shift for a small dataset under 10k rows, a medium dataset, or a large one over 1M rows). Explain how you would adapt the split for imbalanced labels or time-series data, and why the test set must stay untouched until final evaluation.
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.
You have 10,000 unlabeled items and a budget to label only 500 of them. Propose a labeling strategy to maximize downstream model performance: your sampling approach (random, stratified, or active/uncertainty sampling), quality-control measures, an expected timeline, and the trade-offs between them.
Write a SQL query that flags outlier transactions per user directly in the warehouse (using the IQR method, or a mean/standard-deviation rule over a trailing window), returning the flagged rows along with the statistics used to flag them. Discuss performance considerations (window functions, indexes/partitions) for a large table and how you would handle users with very little history.
Design a checklist and technical approach to make a preprocessing pipeline reproducible across a team: versioning of code and dependencies, deterministic transforms (fixed random seeds), serialization of fitted transformers and scalers, data contracts and schema checks, and unit or integration tests. How would you enforce this via CI/CD, and how would you document it so both engineers and non-technical stakeholders can trust and audit a given model run?
Unlock Full Question Bank
Get access to all 30 Data Preparation and Class Imbalance for ML interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.