calour.training.SortedStratifiedKFold

class calour.training.SortedStratifiedKFold(n_splits=3, shuffle=False, random_state=None)[source]

Bases: sklearn.model_selection._split.StratifiedKFold

Stratified K-Fold cross validator.

Please see sklearn.model_selection.StratifiedKFold for documentation for parameters, etc. It is very similar to that except this is for regression of numeric values.

This implementation basically assigns a unique label (int here) to each consecutive n_splits values after y is sorted. Then rely on StratifiedKFold to split. The idea is borrowed from this blog.

Methods

repr(sskf) Return repr(self).
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.

Attributes