I'm trying to understand how to use the cross-validation function sklearn.model_selection.KFold. If I define (like in this tutorial)
from sklearn.model_selection import KFold
kf = KFold(n_splits=5, shuffle=False, random_state=100)
I get
ValueError: Setting a random_state has no effect since shuffle is False.
You should leave random_state to its default (None), or set shuffle=True.
What does this error mean and why is it necessary to set random_state=None or shuffle=True?
Shuffling in this context means that the data is first randomly shuffled before splitting into test/train. The random_state will allow the way in which the data is shuffled to be repeatable. Without the shuffling switched on, the random_state has no meaning.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With