What Is Cross-Validation in Machine Learning?

Machine Learning Cross-Validation Explainer

Cross-validation is a method for estimating how a model may perform on unseen data by repeating training with different held-out subsets. In common k-fold cross-validation, the dataset is divided into k folds. Each fold serves once as validation data while the others are used for training.

The scores across folds show both average performance and variation caused by the split. This can be more informative than a single train-validation division, especially for modest datasets. It also costs more because the model must be fitted repeatedly.

The splitting strategy must match the data. Stratified folds preserve class proportions, grouped folds keep related records together, and time-series splits respect chronological order. Randomly scattering records from the same person, device, location, or future period across folds can leak information and inflate results.

Cross-validation helps compare approaches and tune hyperparameters, but it does not eliminate the need for a final independent test. Results still depend on whether the available data represent deployment conditions. Teams should report the split design, metric, uncertainty, and any grouping or time constraints.

Cross-validation repeatedly changes which examples train and evaluate a model to estimate performance more reliably.

Key terms include fold, k-fold, validation, stratification, group split, time-series split, leakage, score variance and held-out test.

Every example is used for validation in one fold and for training in the remaining folds, producing several performance estimates.

The mean summarizes typical performance, while the spread can reveal sensitivity to the particular examples held out.

Related records should stay together, and future observations should not leak into models evaluated on earlier periods.

A technically correct k-fold routine can still mislead when the dataset or split ignores the way the model will encounter new cases.

Explore more "Explainers"

Discover additional explainers across politics, science, business, technology, and other fields. Each explainer breaks down a complex idea into clear, everyday language—helping you better understand how major concepts, systems, and debates shape the world around us.