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.
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.
Explain the mixup and CutMix augmentation techniques for supervised image classification: how does each construct a new training example (both the input and the label), and why do they tend to improve generalization and calibration? Note a data regime or task (small datasets, localization-sensitive tasks, multi-label) where you would prefer one over the other.
Explain why standard (shuffled) k-fold cross-validation is inappropriate for many time-series tasks, and describe at least two time-aware alternatives: rolling-window (walk-forward) validation and an expanding window. Outline how you would implement one of them in code, and how you would additionally preserve an approximate positive-class ratio per fold if the target is also rare.
In scikit-learn, what is the difference between calling fit_transform on your training features and calling transform (not fit_transform) on your test features? Show the code, and explain concretely what information would leak into your evaluation if you fit the scaler on the combined train+test data instead.
Compare common outlier-detection techniques for a numeric feature: IQR-based capping or trimming, z-score and robust z-score, Winsorization, and (for a multivariate view) Isolation Forest, Local Outlier Factor, or DBSCAN-based approaches. For each, note the distributional assumptions, sensitivity to sample size and skew, and how treatment differs by downstream model type.
Unlock Full Question Bank
Get access to all Data Preparation and Class Imbalance for ML interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.