Note

This page is a reference documentation. It only explains the class signature, and not how to use it. Please refer to the What you really need to know section for the big picture.

julearn.model_selection.RepeatedContinuousStratifiedKFold#

class julearn.model_selection.RepeatedContinuousStratifiedKFold(n_bins, method='binning', n_splits=5, n_repeats=10, random_state=None)#

Repeated Contionous Stratified K-Fold cross validator.

Repeats julearn.model_selection.ContinuousStratifiedKFold n times with different randomization in each repetition.

Parameters:
n_binsint

Number of bins/quantiles to use.

methodstr, default=”binning”

Method used to stratify the groups. Can be either “binning” or “quantile”. In the first case, the groups are stratified by binning the target variable. In the second case, the groups are stratified by quantiling the target variable.

n_splitsint, default=5

Number of folds. Must be at least 2.

n_repeatsint, default=10

Number of times cross-validator needs to be repeated.

random_stateint, RandomState instance or None, default=None

Controls the generation of the random states for each repetition. Pass an int for reproducible output across multiple function calls.

Notes

Randomized CV splitters may return different results for each call of split. You can make the results identical by setting random_state to an intege

__init__(n_bins, method='binning', n_splits=5, n_repeats=10, random_state=None)#
get_metadata_routing()#

Get metadata routing of this object.

Please check User Guide on how the routing mechanism works.

Returns:
routingMetadataRequest

A MetadataRequest encapsulating routing information.

get_n_splits(X=None, y=None, groups=None)#

Returns the number of splitting iterations in the cross-validator

Parameters:
Xobject

Always ignored, exists for compatibility. np.zeros(n_samples) may be used as a placeholder.

yobject

Always ignored, exists for compatibility. np.zeros(n_samples) may be used as a placeholder.

groupsarray-like of shape (n_samples,), default=None

Group labels for the samples used while splitting the dataset into train/test set.

Returns:
n_splitsint

Returns the number of splitting iterations in the cross-validator.

split(X, y=None, groups=None)#

Generates indices to split data into training and test set.

Parameters:
Xarray-like of shape (n_samples, n_features)

Training data, where n_samples is the number of samples and n_features is the number of features.

yarray-like of shape (n_samples,)

The target variable for supervised learning problems.

groupsarray-like of shape (n_samples,), default=None

Group labels for the samples used while splitting the dataset into train/test set.

Yields:
trainndarray

The training set indices for that split.

testndarray

The testing set indices for that split.