trent-b / iterative-stratification

scikit-learn cross validators for iterative stratification of multilabel data
BSD 3-Clause "New" or "Revised" License
852 stars 75 forks source link

Unable to set random_state without setting shuffle=True #29

Open raahilshah opened 1 year ago

raahilshah commented 1 year ago

Despite documentation suggesting that since randomness is applied not just on shuffle, that this use case is intended, but doesn't seem to work:

    cv = MultilabelStratifiedKFold(cv, random_state=RANDOM_STATE)
  File "/Users/raahilshah/opt/anaconda3/envs/storm/lib/python3.8/site-packages/iterstrat/ml_stratifiers.py", line 157, in __init__
    super(MultilabelStratifiedKFold, self).__init__(n_splits=n_splits, shuffle=shuffle, random_state=random_state)
  File "/Users/raahilshah/opt/anaconda3/envs/storm/lib/python3.8/site-packages/sklearn/model_selection/_split.py", line 296, in __init__
    raise ValueError(
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.