Skip to content

Non ancora disponibile in italiano. Vedi tutto ciò che è disponibile in italiano

Stockertim Dictionary · Technology · Artificial intelligence

Cross-validation

Also called cross validation, k-fold cross-validation, CV

In short

Testing a model several times, each time holding out a different part of the data for evaluation, to estimate how well it performs on data it has not seen.

  • Advanced
  • Process
  • Checked

In detail

A single split of data into training and test portions gives one estimate of performance, which may be lucky or unlucky. Cross-validation repeats the exercise. In k-fold cross-validation the data is divided into k equal parts; the model is trained on k minus one parts and tested on the remaining one, and this is repeated so that each part serves once as the test portion. The average score, and how much it varies, give a steadier picture.

It is also the usual way to tune settings such as the depth of a decision tree or the strength of regularisation: each candidate setting is cross-validated and the best is chosen. A final test set kept completely apart then checks the chosen model, because repeatedly picking the best of many cross-validated options can itself overfit.

Standard cross-validation shuffles rows at random, which assumes that examples are independent. That fails for time series such as prices, returns or economic data, where shuffling lets the model train on later observations and test on earlier ones, so it effectively sees the future. For such data, splits must follow time, as in walk-forward or rolling-origin validation, often with a gap between training and test periods.

Worked example

A credit model is tested with 5-fold cross-validation, giving accuracy scores of 81%, 79%, 83%, 80% and 82%.

  1. Sum of scores: 81% + 79% + 83% + 80% + 82% = 405%
  2. Average: 405% / 5 = 81%
  3. Range: 83% − 79% = 4%, meaning four percentage points

The model scores about 81% on held-out data, with results varying by four points across folds.

In practice

Data scientists in banks, insurers and investment firms use cross-validation for model selection, and validators check that the method suited the data. For trading and forecasting models, reviewers specifically ask whether splits respected time order.

Watch out

  • Random shuffling on time-series data leaks the future and inflates results.
  • Cross-validation does not replace a final untouched test set or monitoring after launch.

Learn it properly

Official sources

Facts last checked on 4 November 2026.

Education, not advice: the Stockertim Dictionary explains what terms mean. It never recommends buying or selling anything.

English