What is stratified k-fold cross-validation, and why is it preferred over ordinary k-fold on imbalanced classification datasets?

ML systems and evaluation, Cross-validation
Level L1 Beginner. Length One-liner. Nature Th Theoretical.

What's being asked

Whether you know how stratified splitting preserves class ratios across folds and why that reduces validation variance.

Key idea

Stratified k-fold cross-validation partitions the dataset into k folds so that each fold has roughly the same class proportions as the full dataset, preventing folds with very few or zero minority-class examples.

Steps

  1. Define stratified k-fold: split each class separately into k roughly equal parts and combine one part from each class to form each fold.
  2. Contrast with ordinary k-fold: random splitting on an imbalanced dataset (say 2% positives) can produce folds with almost no positive examples, making per-fold precision, recall or AUC undefined or noisy.
  3. Conclude that stratification keeps class proportions nearly constant across folds, giving lower-variance metric estimates without changing the overall dataset.

Common mistakes

How long your answer should be

1–2 sentences.

Last checked on 4 December 2026.

Read this

Previous in ML systems and evaluation: What is training–serving skew?
Next in ML systems and evaluation: What is the difference between demographic parity and equalised odds, and why can a perfect classifier violate demographic parity?