Module random

Module random 

Source
Expand description

Random number generation utilities

Structs§

DistributionSampler
Advanced distribution sampling utilities
ThreadSafeRng
Thread-safe random state management

Functions§

bootstrap_indices
Bootstrap sampling: sample n_samples with replacement
get_rng
Get a random number generator with the specified seed
importance_sampling
Importance sampling: sample indices according to importance weights
k_fold_indices
Generate k-fold cross-validation indices
random_indices
Generate random indices for sampling
random_permutation
Generate a random permutation of indices
random_weights
Generate random weights that sum to 1
reservoir_sampling
Reservoir sampling: efficiently sample k items from a stream of unknown size
set_random_state
Set the global random seed for reproducible results
shuffle_indices
Shuffle an array of indices in place
stratified_split_indices
Generate stratified train/test split indices
train_test_split_indices
Split indices into train/test sets
weighted_sampling_without_replacement
Weighted sampling without replacement using systematic sampling