Sub topic 3
Fold-to-Fold Variability and Error Bands
Assume supervised learning, scikit-learn estimators, cross-validation, and basic overfitting concepts. A cross-validation fold is one train-validation split. A curve usually reports the mean score across folds, while an error band shows how much those scores vary.
Fold-to-Fold Variability and Error Bands
For each training-set size or hyperparameter value, calculate the mean and standard deviation across folds:
- The mean estimates typical validation performance.
- The standard deviation measures fold-to-fold variability.
- A wide band means the estimate is sensitive to the particular samples in each fold.
A band of one standard deviation is not automatically a confidence interval. It describes spread among folds, not certainty about the population score.
From Diagnosis to Action
Use both the curve values and their bands.
| Pattern | Likely diagnosis | Useful response |
|---|---|---|
| Low training and validation scores | High bias | Add features or use a more flexible model |
| High training score, lower validation score | High variance | Add data or increase regularization |
| Wide validation band | Unstable estimate | Use more data or better resampling |
A small difference between two candidate settings may be meaningless when their bands overlap heavily. Prefer a simpler setting when performance is practically tied.
Using Curves in a Tuning Workflow
Use a validation curve to inspect one hyperparameter while holding the others fixed. Select a value near the best validation score, then confirm it with a separate test set or nested cross-validation. Do not select a value from the test score.
Use a learning curve to decide whether collecting more training data is likely to help. If the validation curve is still rising and the gap is narrowing, more data may improve performance.
Common Pitfalls
Fit preprocessing, feature selection, and dimensionality reduction inside a pipeline. Otherwise, information from validation folds can leak into training.
If samples belong to patients, users, devices, or sessions, use grouped splitting. GroupKFold keeps all samples from one group on the same side of each split.
Cross-validation can be expensive because each curve point requires multiple model fits. Use fewer points for exploration, then run a focused search.
Iteration and Epoch Curves
For iterative learners, plot score against iterations or epochs. Training score may keep rising while validation score peaks and then falls. Stop near the validation peak, or use early stopping. This curve diagnoses overfitting over time rather than over training-set size or a hyperparameter.
Exercise
A model has a high training score, a lower validation score, and a wide validation band. What should you try first?
Show answer
Check for leakage and unsuitable splits, then try more representative data or stronger regularization.