Skip to content

Home / Glossary / Cross-Validation

Statistics

Cross-Validation

Splitting data into train/test folds to evaluate model generalisation.

K-fold cross-validation splits data into K parts, trains on K-1 and tests on the held-out fold, repeating K times. It gives a more robust estimate of model performance than a single train/test split.

Example

from sklearn.model_selection import cross_val_score
scores = cross_val_score(model, X, y, cv=5)

Practise Cross-Validation hands-on — free, in your browser

Related terms