k-fold cross-validation is a model validation technique used to estimate the test error of a statistical learning method. It is implemented in the following steps:
This technique helps in assessing how the model is expected to perform on unseen data, making it a popular and powerful tool for model evaluation.
Validation set approach involves splitting the dataset into two parts: a training set and a validation (or test) set. The model is trained on the training set and evaluated on the validation set.
Advantages of k-fold CV over validation set approach:
- More efficient use of data where every observation is used for both
training and validation.
- It has Lower variance as Averaging across k iterations
provides a more stable and accurate estimate of test error.
- Better generalization, especially important when the dataset is small,
as k-fold CV helps avoid bias due to a bad split.
Disadvantages:
- Higher computational cost as training k models instead of
one makes this approach slower.
- Implementation complexity as more steps and logic required to set up
k-fold CV compared to a single validation split.
LOOCV is a special case of k-fold CV where k equals the number of observations (i.e., each fold contains only one observation).
Advantages of k-fold CV over LOOCV:
- Lower computational burden: k-fold CV requires training
only k models, whereas LOOCV requires training n
models (one for each observation).
- Lower variance in the estimated test error due to less similarity
between the training sets (LOOCV’s training sets are highly
correlated).
- Better bias-variance trade-off: While LOOCV has lower bias, its higher
variance can make it less desirable. k-fold CV balances this
well, especially with k = 5 or 10.
Disadvantages:
- Slightly higher bias: Since each training set in k-fold CV
is smaller than in LOOCV, the bias of the test error estimate may be
higher.
- Less efficient use of data: LOOCV makes use of the maximum possible
training data in each iteration.
To estimate the standard deviation (or uncertainty) of a prediction \(\hat{Y}\) for a given value of predictor \(X\), we can use the bootstrap method, which provides a non-parametric approach to measuring prediction variability.
Here’s how we can estimate the standard deviation of the prediction:
This process captures the variability that arises due to sampling variability in the training data. It is especially useful when there is no closed-form expression for the variance of the prediction.