AI Glossary / Causal inference and experimentation / Intermediate
10-fold cross-validation
Definition
10-fold cross-validation is a model-evaluation procedure that divides a dataset into ten parts, trains a fresh model on nine parts, and evaluates it on the remaining part. The process repeats until each part has served once as the held-out fold. The resulting scores summarize performance across the ten splits. The method is useful only when the way the folds are formed matches the relationships and intended use of the data.
What it means
The procedure reuses limited data efficiently: each observation is evaluated out of sample once and is included in training for the other nine fits. It does not train one model repeatedly while carrying its learned weights from fold to fold. Instead, each fit starts as required by the specified training procedure, without information learned from its held-out fold. The score describes a learning procedure trained on roughly 90% of the available data, and it is an estimate rather than a guarantee for a final deployed model.
How it works
Define an appropriate splitter and evaluation metric, then perform ten separate training-and-evaluation runs. Fit preprocessing steps such as scaling, imputation, and feature selection using only the training portion in each run. Apply those fitted transformations to its held-out portion. Summarize the scores and inspect variation and important subgroups. For classification, stratification can help preserve class proportions, while repeated entities may require grouped splits. Temporal prediction often needs an order-respecting evaluation design instead of ordinary shuffled folds.
Three practical examples
- Tabular model comparison: compare two training procedures using the same ten folds and the same preprocessing discipline.
- Hyperparameter development: use folds within the development data to choose settings, while reserving an independent assessment strategy for the selected procedure.
- Small-dataset analysis: inspect how evaluation changes across different held-out subsets rather than relying on one arbitrary train-validation split.
Think of it this way
Think of ten practice rounds in which a different bundle of examples is sealed away before the learner prepares. Each bundle is opened only for that round's assessment. The analogy captures rotation of held-out data. Its limit is that the rounds share many training examples, so their scores are correlated rather than ten fully independent experiments.
Worked example
Suppose 1,000 independent labeled records are divided into ten equal folds of 100. Each fit uses 900 records and evaluates on 100. Imagine the numbers of correct predictions are 82, 85, 80, 88, 84, 86, 83, 87, 81, and 84. The sum is 840, so pooled out-of-fold accuracy is 840/1,000 = 84%. Because all folds have equal size and accuracy averages per-record correctness, the mean of the ten fold accuracies is also 84%.
There are ten fitted models in this evaluation. Each record contributes once to held-out scoring and appears in nine training subsets, but this does not create 10,000 independent observations. The fold accuracies range from 80% to 88%; that range is descriptive, not a confidence interval. If folds have unequal sizes, an unweighted mean of fold accuracies can differ from accuracy computed across all held-out predictions. For nonlinear metrics such as F1, even equal fold sizes do not generally make the mean of fold scores equal the score computed after pooling predictions.
Illustrative case study
A fictional document-classification team obtains strong 10-fold results after randomly splitting individual pages. It later discovers that pages from the same document appear in both training and evaluation folds. The model can exploit repeated wording and layout. The team rebuilds the folds at the document level and refits text preprocessing within each training portion. It reports the revised estimate and explains that preventing related-record leakage matters more than retaining a convenient random split.
Common misconceptions and mistakes
Ten folds are not universally optimal, and the number ten does not cure data leakage. Fitting a scaler or feature selector on the full dataset before splitting exposes information from held-out examples. Selecting the best of many settings and reporting that same selection score as an unbiased final estimate can be optimistic. Fold-to-fold standard deviation is not automatically a valid standard error for the final model because training sets overlap. Stratification preserves class proportions approximately but does not make dependent records independent.
Business use
Use 10-fold cross-validation when its data requirements and computational cost fit the task. The full pipeline is typically trained ten times for each candidate setting, so complex searches can be expensive. Choose splits that reflect how future examples differ from training data, and use identical splits for fair candidate comparisons. After selecting a procedure, a final model is often fitted on the designated development data; assess the selection process with an untouched test set or suitable nested evaluation when needed. Keep the final evaluation data out of iterative model choices.
People also ask
Is this the same as training for ten epochs?
No. Epochs repeat optimization over training data; ten folds define separate training and held-out subsets.
Do I automatically deploy all ten models?
No. Cross-validation is an evaluation procedure; ensembling its fitted models is a separate decision.
Can I use ordinary shuffled folds for future forecasting?
Often that would mix future and past information. Use a temporal design appropriate to the prediction task.
Check your understanding
In the example, why are 840 correct held-out predictions divided by 1,000 rather than 10,000?
Answer: Each record receives one held-out prediction in a single ten-fold run. Its appearances in other training subsets are not extra independent evaluation cases.
Related terms
- Cross-validation
- Stratification
- Data leakage
- Pipeline
- Nested cross-validation
- K-fold
- grouped split
- out-of-fold prediction
- hyperparameter tuning
- temporal validation
Learn next
Trace one observation through all ten folds and identify when it is used for fitting versus scoring. Then place preprocessing inside the training pipeline. Study grouped and temporal splitters before choosing folds for related records or forecasting, and distinguish model selection from final performance assessment.
More in Causal inference and experimentation
- A/B testing - A/B testing is a randomized experiment that compares two versions of a product, process, or experience by assigning eligible units to different conditions...
- A-optimal design - A-optimal design is an experimental-design criterion that chooses observations to minimize the sum, or equivalently the average for a fixed number of...
- Accuracy - Accuracy is the proportion of evaluated predictions that match the correct labels under a stated scoring rule.
- Area under the PR curve - Area under the PR curve summarizes a model's precision-recall tradeoff as its decision threshold changes.
- AUC (Area under the ROC curve) - AUC, when specified as area under the ROC curve, summarizes how well prediction scores separate positive from negative examples across decision thresholds.
- Augmented inverse probability weighting - Augmented inverse probability weighting, or AIPW, is a causal estimation approach that combines outcome predictions with corrections weighted by treatment...
Sources
Scikit-learn, Cross-validation: evaluating estimator performance: https://scikit-learn.org/stable/modules/cross_validation.html Scikit-learn, common pitfalls and data leakage: https://scikit-learn.org/stable/common_pitfalls.html Bates, Hastie, and Tibshirani, Cross-validation: what does it estimate and how well does it do it?: https://arxiv.org/abs/2104.00673
Previous: (1+ε)-approximate nearest neighbor search Next: 2-level designs