Cross-Validation
Essential model evaluation technique! Learn K-Fold, Stratified K-Fold, and Time Series Split. Understand how to properly assess model performance and avoid data leakage.
Cross-Validation VisualizerK-Fold CV
CV Parameters
Splits data into K equal folds, each used once as test
Controls
CV Results
Fold 1 / 5
Why Not Just a Single Train/Test Split?
The same model evaluated on 8 different random 80/20 splits gives wildly different accuracy estimates. Which one would you trust?
The problem: a lucky split gives 95% — making you think the model is great. An unlucky split gives 76% — making you think it is terrible. CV gives 78.6% ± 6.9% — a reliable estimate from all the data.
Scores Across Folds
K-Fold CV
• Most common method
• Equal-sized folds
• Use for balanced data
Stratified K-Fold
• Maintains class balance
• Critical for imbalanced data
• Use for classification
Time Series Split
• Respects temporal order
• No future data leakage
• Use for time series only
Run k-fold correctly
Order one fold of a k-fold evaluation.
Tap a piece, then tap where it goes — or drag it. Tap the tray to take one back.
- 1Drop a step here
- 2Drop a step here
- 3Drop a step here
- 4Drop a step here
- 5Drop a step here
- 6Drop a step here
Test your knowledge
K-fold cross-validation works by…
Interview Questions
Love this visualization?
Sign up to track your progress, earn achievements, use the AI assistant, and access your personal learning dashboard.
100% free • No credit card required