What is stratified -fold cross-validation, and why is it preferred over ordinary -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 -fold cross-validation partitions the dataset into 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
- Define stratified -fold: split each class separately into roughly equal parts and combine one part from each class to form each fold.
- Contrast with ordinary -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.
- Conclude that stratification keeps class proportions nearly constant across folds, giving lower-variance metric estimates without changing the overall dataset.
Common mistakes
- Using stratified -fold on grouped or time-series data where observations are not independent; patient or temporal structure takes priority over class balance.
- Confusing stratification (balancing fold class ratios to match the data) with oversampling (duplicating minority examples inside training).
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?