What is -fold cross-validation, how do the bias and the computation cost of the error estimate change with , and why are and the usual choices?
Foundations, Model selection
Level L2 Elementary. Length Medium. Nature Th+Mat Both.
What's being asked
Whether you understand how -fold cross-validation works and how trades training-set size against computation cost.
Key idea
You split data points into equal parts (folds), train times leaving one fold out each time, and average the validation errors: . Small trains on much less than points (pessimistic bias), while very large (such as leave-one-out, ) requires many fits.
Steps
- Describe the procedure: shuffle and split the dataset into equal folds. Train the model on folds, evaluate its error on the held-out fold , repeat so each fold is held out once, and average the scores: .
- Explain the bias effect: each model trains on only of the data — when , when , and when . Because models usually improve with more data, a small overestimates the error of the final model trained on all points.
- Explain the computation cost: -fold cross-validation fits the model times, so (leave-one-out) costs fits, which is prohibitive for large datasets (aside from special shortcuts like ordinary least squares).
- Conclude why or is standard: each fold trains on – of the data (low bias) at a modest cost of or fits, while avoiding where nearly identical training sets share points and yield redundant, correlated fold errors (analysed formally at later levels).
Common mistakes
- Thinking leave-one-out () is always best because it uses the most training data; besides costing fits, its overlapping training sets often make the averaged error estimate noisier than or .
- Scaling features or selecting features on the whole dataset before splitting into folds, which leaks validation information into training.
- Using random folds on time series or grouped data (such as multiple scans per patient), which leaks across time or groups.
How long your answer should be
About 2–3 minutes: explain the procedure, then bias, cost and why or works well.
Read this
- James, Witten, Hastie and Tibshirani, An Introduction to Statistical Learning (ISLR, 2nd ed.): Free PDF. Section 5.1.4, Bias-Variance Trade-Off for k-Fold Cross-Validation (p. 205): why k = 5 or 10 beats LOOCV on variance and cost.
- Hastie, Tibshirani and Friedman, The Elements of Statistical Learning (ESL, 2nd ed.): Free PDF. Section 7.10.1, K-Fold Cross-Validation (pp. 241–244), with Figure 7.8: the learning-curve argument for the bias of small K.
- NPTEL: Introduction to Machine Learning (IIT Madras, Prof. Balaraman Ravindran): Week 7, Evaluation and Evaluation Measures II (Bootstrapping and Cross Validation): covers k-fold cross-validation and its error estimates.
Previous in Foundations: Your model has 2% training error and 25% validation error. What is the problem, and what would you try? What if instead both errors were about 24%?
Next in Foundations: Data are spread uniformly in the unit hypercube . A nearest-neighbour method uses a small cube around each point that contains 1% of the data. What edge length must that cube have for , and , and what does this say about local methods in high dimensions?