ertk.train.ShuffleGroupKFold

class ertk.train.ShuffleGroupKFold(n_splits=5, *, shuffle=False, random_state=None)

Bases: _BaseKFold

Like GroupKFold but with random combinations of groups instead of deterministic combinations based on group size. This is most useful if you have groups of near equal size, and you want group k-fold CV, where k divides n_groups.

Note: If shuffle=False, this does not behave identical to GroupKFold, but rather splits groups in sorted order (as returned by numpy.unique()).

__init__(n_splits=5, *, shuffle=False, random_state=None)

Methods

__init__([n_splits, shuffle, random_state])

Inherited Methods

get_n_splits([X, y, groups])

Returns the number of splitting iterations in the cross-validator

split(X[, y, groups])

Generate indices to split data into training and test set.