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.StratifiedBootstrap¶
- class julearn.model_selection.StratifiedBootstrap(n_splits=200, random_state=None)¶
Class-wise stratified bootstrap cross-validator.
Provides train/test indices to split data in train/test sets.
This cross-validation object returns stratified randomized folds. The folds are made by preserving the percentage of samples for each class in y in a binary or multiclass classification setting.
- Parameters:
n_splits (
int, default:200) – Number of bootstrap iterations.random_state (
int|RandomState|None, default:None) – Controls the randomness of the training and testing indices produced. Pass an int for reproducible output across multiple function calls.
- __init__(n_splits=200, random_state=None)¶
- split(X, y, groups=None)¶
Generate indices to split data into training and test set.
- Parameters:
X (array-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.
y (array-like of shape (n_samples,)) – The target variable for supervised learning problems.
groups (array-like of shape (n_samples,), default=None) – Group labels for the samples used while splitting the dataset into train/test set.
- Yields:
train (ndarray) – The training set indices for that split.
test (ndarray) – The testing set indices for that split.
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 integer.
- get_n_splits(X=None, y=None, groups=None)¶
Return the number of splitting iterations in the cross-validator.
- get_metadata_routing()¶
Get metadata routing of this object.
Please check User Guide on how the routing mechanism works.
- Returns:
A
MetadataRequestencapsulating routing information.