Beginner · Fundamentals
Cross-Validation
Visual diagram · (in preparation) · Math · (in preparation) · Worked example · 3 difficulty levels.
TL;DR. A technique that evaluates model performance by training and testing on different subsets of the data in rotation.
Technical Definition
A technique that evaluates model performance by training and testing on different subsets of the data in rotation.
How it works
K-fold cross-validation splits data into K equal parts. The model trains on K-1 folds and tests on the remaining fold, repeating K times so every fold serves as the test set once. The final score averages all K runs. This gives a more reliable performance estimate than a single train-test split, especially with limited data. Common choices are K=5 or K=10.
Related Concepts
- Loss Function — A mathematical function that measures how far the model's predictions are from the actual values, guiding the learning process.
- Overfitting — When a model learns noise and specific patterns in training data too well, causing it to perform poorly on new, unseen data.
- Bias-Variance Tradeoff — The tension between a model's ability to fit training data (low bias) and its ability to generalize to new data (low variance).