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=5, test_size=0.5, train_size=None, random_state=None)#
- Stratified Bootstrap cross-validation iterator. - Provides train/test indices using resampling with replacement, respecting the distribution of samples for each class. - Parameters:
- n_splitsint, default=5
- Number of re-shuffling & splitting iterations. 
- test_sizefloat, int, default=0.2
- If float, should be between 0.0 and 1.0 and represent the proportion of groups to include in the test split (rounded up). If int, represents the absolute number of test groups. If None, the value is set to the complement of the train size. The default will change in version 0.21. It will remain 0.2 only if - train_sizeis unspecified, otherwise it will complement the specified- train_size.
- train_sizefloat or int, default=None
- If float, should be between 0.0 and 1.0 and represent the proportion of the groups to include in the train split. If int, represents the absolute number of train groups. If None, the value is automatically set to the complement of the test size. 
- random_stateint or RandomState instance, 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=5, test_size=0.5, train_size=None, 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. Note that providing - yis sufficient to generate the splits and hence- np.zeros(n_samples)may be used as a placeholder for- Xinstead of actual training data.
- yarray-like of shape (n_samples,) or (n_samples, n_labels)
- The target variable for supervised learning problems. Stratification is done based on the y labels. 
- groupsarray-like of shape (n_samples,), default=None
- Group labels for stratifying 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_metadata_routing()#
- Get metadata routing of this object. - Please check User Guide on how the routing mechanism works. - Returns:
- routingMetadataRequest
- A - MetadataRequestencapsulating 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. 
- 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. 
 
 
 
