EasyDeepLearn

What is k-fold cross-validation and when do you use stratified or grouped folds?

medium

Answer

  • Split the data into k folds; train on k-1 and validate on the held-out fold, then average.
  • Use stratified k-fold for classification (preserves class ratios per fold).
  • Use grouped k-fold when rows share an identity (same user, same patient) so the group never appears in both train and validation, preventing leakage.
  • Use time-series split for temporal data.
Check yourself — multiple choice
  • Stratified k-fold is only for regression
  • Grouped k-fold prevents leakage when rows share an entity
  • Time-series data should use random k-fold
  • k-fold requires at least 100 folds

Grouped k-fold keeps all rows of the same entity in one fold, preventing subject leakage.

#evaluation#validation

Practise Supervised Learning

215 interview questions in this topic.

Related questions