Cross-validation

term_id: cross_validation

Category: training_techniques

Definition

Cross-validation is a statistical method used to estimate the skill of machine learning models. The most common form is k-fold cross-validation, where the data is split into k equal parts. The model is trained on k-1 folds and validated on the remaining fold, repeating this process k times so each fold serves as the validation set once. This approach provides a more robust estimate of model performance than a single train-test split, helping to detect overfitting and ensuring the model generalizes well to unseen data.

Summary

A resampling procedure used to evaluate machine learning models on a limited data sample by partitioning data into subsets for training and testing.

Key Concepts

  • K-Fold Split
  • Model Generalization
  • Overfitting Detection
  • Performance Estimation

Use Cases

  • Hyperparameter tuning
  • Comparing different algorithms
  • Validating model stability on small datasets

Code Example

1
2
from sklearn.model_selection import cross_val_score
cv_scores = cross_val_score(model, X, y, cv=5)