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_splitsint, default=200
Number of bootstrap iterations.
- random_stateint or RandomState instance or 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:
- 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.
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.
- Parameters:
- Xobject
Always ignored, exists for compatibility.
- yobject
Always ignored, exists for compatibility.
- groupsobject
Always ignored, exists for compatibility.
- Returns:
- n_splitsint
Returns 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:
- routingMetadataRequest
A
MetadataRequestencapsulating routing information.