Why must validation and test sets preserve the original class distribution?

Quick Overview

Asks why validation and test sets for an imbalanced classification problem should keep the original class distribution when the training data is resampled. Tests your understanding of evaluation metrics, threshold selection, calibration and the right order of splitting and resampling.

Why must validation and test sets preserve the original class distribution?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: easy

Interview Round: Other

Suppose a binary classifier is trained on an imbalanced dataset, and the training data is oversampled or undersampled to deal with the imbalance. Why must the validation and test sets preserve the original class distribution? ```hint Where to look Write out how precision depends on the positive rate, and think about what else you tune on the validation set besides the model weights. ``` ### What a Strong Answer Covers - What validation and test sets are meant to estimate. - Which metrics depend on class prevalence and which do not, and what that means for a balanced test set. - How threshold choice and probability calibration depend on the evaluation distribution. - The leakage risk when synthetic or duplicated samples end up in evaluation data. - The correct order of splitting and resampling, and what to do when production prevalence differs from the historical data. ### Follow-up Questions - Your historical data has 2% positives but production is expected to run at 0.5%. How would you adjust the evaluation? - A model was trained on a 50/50 resampled set. How would you correct its predicted probabilities for the real base rate? - In k-fold cross-validation with SMOTE, where in the pipeline does the resampling step belong, and why? - Why can a model have a high ROC-AUC and still be unusable at a 1% base rate?

Overview: Asks why validation and test sets for an imbalanced classification problem should keep the original class distribution when the training data is resampled. Tests your understanding of evaluation metrics, threshold selection, calibration and the right order of splitting and resampling.

General logo
General
Nov 24, 2026
easyMachine Learning EngineerOtherMachine Learning
0
0

Suppose a binary classifier is trained on an imbalanced dataset, and the training data is oversampled or undersampled to deal with the imbalance. Why must the validation and test sets preserve the original class distribution?

What a Strong Answer Covers Guidance

  • What validation and test sets are meant to estimate.
  • Which metrics depend on class prevalence and which do not, and what that means for a balanced test set.
  • How threshold choice and probability calibration depend on the evaluation distribution.
  • The leakage risk when synthetic or duplicated samples end up in evaluation data.
  • The correct order of splitting and resampling, and what to do when production prevalence differs from the historical data.

Follow-up Questions Guidance

  • Your historical data has 2% positives but production is expected to run at 0.5%. How would you adjust the evaluation?
  • A model was trained on a 50/50 resampled set. How would you correct its predicted probabilities for the real base rate?
  • In k-fold cross-validation with SMOTE, where in the pipeline does the resampling step belong, and why?
  • Why can a model have a high ROC-AUC and still be unusable at a 1% base rate?