Dhiraj K

Jan 13, 2021

1 min read

What is nested cross-validation?

Nested vs Non-nested Cross-Validation in Machine Learning

As we know Cross-Validation can be used for model error estimation as well as model hyperparameter optimization.

If we are doing either model’s error estimation or the model’s hyperparameter optimization then we can use non-nested simple k-fold cross-validation.
However, if cross-validation is used simultaneously for the model’s error estimation AND the model’s hyperparameter optimization, nested cross-validation is required.

This is because, if the same cross-validation procedure is used for the model’s error estimation AND the model’s hyperparameter optimization, the model’s error estimation may be biased.

One way to fix this bias is to nest the hyperparameter optimization Cross-Validation procedure under the model selection Cross-Validation procedure.
This is called nested Cross-Validation.
Please watch the video Nested vs Non-nested Cross-Validation in Machine Learning for a more detailed explanation.

Nested vs Non-nested Cross-Validation in Machine Learning