StratifiedFold
Stratified K-Folds cross-validator
Provides train/test indices to split data in train/test sets.
This cross-validation object is a variation of KFold that returns stratified folds. The folds are made by preserving the percentage of samples for each class.
class sklearn.model_selection.StratifiedKFold(n_splits=’warn’, shuffle=False, random_state=None)
Parameters:
n_splits : int, default=3
Number of folds. Must be at least 2.
Changed in version 0.20: n_splits default value will change from 3 to 5 in v0.22.
shuffle : boolean, optional
Whether to shuffle each class’s samples before splitting into batches.
random_state : int, RandomState instance or None, optional, default=None
If int, random_state is the seed used by the random number generator; If RandomState instance, random_state is the random number generator; If None, the random number generator is