Why does the following code cant get value of n_fold = 1?

Do you understand the concept of cross validation? In k-fold cross validation your data is split in k samples and one sample is used to test the model and k-1 samples are used to train the model.

If you set k = 1 (or n = 1 in your example) you won’t be able to sample your data and perform the cross validation.

Leave a Comment