• ↑↓ pour naviguer
  • pour ouvrir
  • pour sélectionner
  • ⌘ ⌥ ↵ pour ouvrir dans un panneau
  • ←→ pour naviguer
  • esc pour rejeter
⌘ '
raccourcis clavier

The Problem

A single train-test split gives a noisy estimate of model performance — different splits give different results, especially on small datasets.

Core Idea

A resampling technique that repeatedly splits data into train and validation sets to get a more robust estimate of model performance.

How It Works

  1. Choose k (typically 5 or 10)
  2. Split data into k roughly equal folds
  3. For each fold i: train on all folds except i, validate on fold i
  4. Compute performance metric for each fold
  5. Average the k performance scores for final estimate

Visual Explanation

G Dataset Dataset Fold 1,2,3,4,5 Fold 1,2,3,4,5 Dataset->Fold 1,2,3,4,5 Train on 4, Validate on 1 Train on 4, Validate on 1 Fold 1,2,3,4,5->Train on 4, Validate on 1 Train on 4, Validate on 2 Train on 4, Validate on 2 Fold 1,2,3,4,5->Train on 4, Validate on 2 Train on 4, Validate on 5 Train on 4, Validate on 5 Fold 1,2,3,4,5->Train on 4, Validate on 5 All Validations All Validations Average Performance Average Performance All Validations->Average Performance

Key Properties

  • Robust: reduces variance of performance estimate compared to single split
  • Computationally expensive: requires training k models instead of one
  • Data-efficient: uses all data for both training and validation (just not simultaneously)
  • Standard: the gold standard for model evaluation in ML research

Connections

Edge Cases & Gotchas

  • Time series data: standard k-fold breaks temporal ordering (use time-series CV)
  • Data leakage: preprocessing (normalization) must be done inside each fold
  • Stratification: for classification, ensure each fold has representative class proportions
  • Small datasets: leave-one-out CV (k=n) can have high variance despite being “exact”