InterviewStack.io LogoInterviewStack.io

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

You have customer records with slightly different spellings, casing, and whitespace in name and address fields (for example due to duplicate entry). Describe a practical end-to-end approach to detect and merge near-duplicates: a blocking or indexing strategy to avoid all-pairs comparison, a choice of string-similarity metric, a threshold for auto-merge versus manual review, and how you would measure the precision and recall of your merges.

MediumTechnical
49 practiced

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.

EasyTechnical
45 practiced

Why can naive random oversampling of the minority class cause overfitting? Describe three mitigation strategies and explain the mechanism by which each reduces the risk.

MediumTechnical
50 practiced

Why is feature scaling important before applying Principal Component Analysis (PCA)? Give a concise example (numeric or conceptual) showing how an unscaled dataset can produce misleading principal components, and describe when it might be acceptable to skip scaling before PCA.

EasyTechnical
43 practiced

What does class imbalance mean for a binary classification problem, and why can accuracy be a misleading metric for it? Walk through a concrete numeric example (for instance a 1% positive rate) showing how a model that never predicts the minority class can still score a high accuracy, and name the first remediation you would try.

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.