pub trait DataProvider: Send {
// Required methods
fn num_samples(&self) -> usize;
fn num_features(&self) -> usize;
fn get_batch(&self, indices: &[usize]) -> (Array2<f32>, Array1<f32>);
// Provided method
fn shuffle_indices(&self, rng_seed: u64) -> Vec<usize> { ... }
}Expand description
Trait for data sources that provide batched (features, targets) pairs.
Implementors are responsible for indexing into their underlying storage and
producing contiguous sub-arrays. The trait is Send so data providers can
be shared across threads.
Required Methods§
Sourcefn num_samples(&self) -> usize
fn num_samples(&self) -> usize
Total number of samples in the dataset.
Sourcefn num_features(&self) -> usize
fn num_features(&self) -> usize
Number of features per sample.
Provided Methods§
Sourcefn shuffle_indices(&self, rng_seed: u64) -> Vec<usize>
fn shuffle_indices(&self, rng_seed: u64) -> Vec<usize>
Produce a permuted index vector using a simple LCG seeded by rng_seed.
This avoids pulling in rand while still providing reproducible shuffles.