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.

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?

MediumTechnical
54 practiced

You trained a Random Forest on a dataset with 0.05% positive examples. It reports 99.9% accuracy but zero recall on the positive class. Explain why this happens and propose at least three concrete changes to improve recall while keeping false positives under control.

MediumTechnical
50 practiced

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?

HardTechnical
47 practiced

Design a stratified mini-batch sampler suitable for distributed synchronous training (for example PyTorch DDP) that keeps class proportions balanced across replicas, guaranteeing at least a minimum number of positive examples per batch even when positives are rare. Outline the algorithm, how you partition indices across ranks, and how you keep the shuffling reproducible across epochs.

HardTechnical
47 practiced

Estimate the timeline, headcount, and cost to collect one million high-quality labeled examples for a new model. State your assumptions (per-label cost, throughput per annotator), then propose concrete strategies to accelerate collection while maintaining quality, such as active learning, synthetic data, or data partnerships.

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.