Skip to content
BENIBIX Learn

Cross-Validation

AI📏 Evaluation & BenchmarksEvaluation Basics

Also known as K-Fold Cross-Validation, K-Fold CV

You test a model many times, each on a new slice of the data. Then you take the average.

Think of it like

It is like having five friends taste a cake. One opinion could be luck, but five is fair.

Example

Jack has only 600 labeled photos. With 5-fold cross-validation, he trains five times, each time testing on a different 120 photos, and gets scores from 84% to 89%.

Why it matters

One test split can be lucky or unlucky. Cross-validation shows the real score and how much it moves.

Definition

Cross-validation is a way to test a model several times on different parts of the data, for a fairer score. The data is split into equal parts, often 5 or 10, called folds. The model is trained on all but one fold and tested on the one left out. This repeats until each fold has been the test once. The scores are then averaged, which also shows how much the result depends on luck.
Five rounds, a different fold tested in each. The five scores are then averaged.

Common mistake

Tuning settings on the same folds you report. Keep a final test set apart that the model never touched.

Key takeaways

  1. 1
    Split into folds. Often 5 or 10.
  2. 2
    Each fold tests once. The rest train.
  3. 3
    Average the scores. Less luck.