SamplingStrategy

Trait SamplingStrategy 

Source
pub trait SamplingStrategy:
    Send
    + Sync
    + Debug {
    // Required methods
    fn sample(
        &self,
        data: &Array2<f64>,
        n_samples: usize,
    ) -> Result<Vec<usize>, SklearsError>;
    fn name(&self) -> &str;

    // Provided methods
    fn requires_fitting(&self) -> bool { ... }
    fn fit(&mut self, _data: &Array2<f64>) -> Result<(), SklearsError> { ... }
    fn weights(&self) -> Option<Array1<f64>> { ... }
}
Expand description

Sampling strategy for selecting landmarks/components

Required Methods§

Source

fn sample( &self, data: &Array2<f64>, n_samples: usize, ) -> Result<Vec<usize>, SklearsError>

Sample indices from the dataset

Source

fn name(&self) -> &str

Get the sampling strategy name

Provided Methods§

Source

fn requires_fitting(&self) -> bool

Check if this strategy requires fitting

Source

fn fit(&mut self, _data: &Array2<f64>) -> Result<(), SklearsError>

Fit the sampling strategy (if needed)

Source

fn weights(&self) -> Option<Array1<f64>>

Get sampling weights (if applicable)

Implementors§