MCPcopy Create free account
hub / github.com/Open-Quant/openquant / bootstrap_sample_indices

Function bootstrap_sample_indices

crates/openquant/src/ensemble_methods.rs:86–96  ·  view source on GitHub ↗
(
    n_samples: usize,
    sample_size: usize,
    seed: u64,
)

Source from the content-addressed store, hash-verified

84}
85
86pub fn bootstrap_sample_indices(
87 n_samples: usize,
88 sample_size: usize,
89 seed: u64,
90) -> Result<Vec<usize>, String> {
91 if n_samples == 0 || sample_size == 0 {
92 return Err("n_samples and sample_size must be > 0".to_string());
93 }
94 let mut rng = StdRng::seed_from_u64(seed);
95 Ok((0..sample_size).map(|_| rng.gen_range(0..n_samples)).collect())
96}
97
98pub fn sequential_bootstrap_sample_indices(
99 ind_mat: &[Vec<u8>],

Calls

no outgoing calls