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 the RandomState ins

StratifiedFold是scikit-learn库中的一个分层K-Folds交叉验证工具,确保每个折中各类样本的比例与整体数据保持一致。它提供了split方法用于划分训练集和测试集,以及get_n_splits方法返回拆分次数。
最低0.47元/天 解锁文章
1158

被折叠的 条评论
为什么被折叠?



