Session Ready
Exercise

scikit-learn's KFold()

You just finished running a colleagues code that creates a random forest model and calculates an out-of-sample accuracy. You noticed that your colleague's code did not have a random state, and the errors you found were completely different than the errors your colleague reported.

To get a better estimate for how accurate this random forest model will be on new data, you have decided to generate some indices to use for KFold cross-validation.

Instructions
100 XP
  • Call the KFold() method to split data using five splits, shuffling, and a random state of 1111.
  • Use the split() method of KFold on X.
  • Print the number of indices in both the train and validation indices lists.