September 2019
Intermediate to advanced
420 pages
10h 29m
English
Another popular way to implement cross-validation is to choose the number of folds equal to the number of data points in the dataset. In other words, if there are N data points, we set k=N. This means that we will end up having to do N iterations of cross-validation, but in every iteration, the training set will consist of only a single data point. The advantage of this procedure is that we get to use all-but-one data points for training. Hence, this procedure is also known as leave-one-out cross-validation.
In scikit-learn, this functionality is provided by the LeaveOneOut method from the model_selection module:
In [11]: from sklearn.model_selection import LeaveOneOut
This object can be passed ...
Read now
Unlock full access