What is the purpose of StratifiedKFold cross-validation and when is it preferred over regular KFold?

Data Science with Python Hard

Data Science with Python — Hard

What is the purpose of StratifiedKFold cross-validation and when is it preferred over regular KFold?

Key points

  • StratifiedKFold maintains class distribution in folds
  • Prevents bias in evaluation for imbalanced datasets
  • Regular KFold may produce folds with different class ratios

Ready to go further?

Related questions