Skip to main content

Balancer

Trait Balancer 

Source
pub trait Balancer:
    BalancerClone
    + Send
    + Sync {
    // Required methods
    fn name(&self) -> &'static str;
    fn fit_resample(
        &self,
        features: &Frame,
        target: &[f64],
    ) -> Result<(Frame, Vec<f64>)>;
}
Expand description

A train-time resampler: given features and a target, produce a rebalanced (Frame, target). Unlike a Transformer, a balancer runs only during fit — never at predict time — because it changes the row set (e.g. SMOTE synthesises minority-class rows).

Required Methods§

Source

fn name(&self) -> &'static str

A short, stable name for diagnostics.

Source

fn fit_resample( &self, features: &Frame, target: &[f64], ) -> Result<(Frame, Vec<f64>)>

Resample (features, target) into a rebalanced pair.

Trait Implementations§

Source§

impl Clone for Box<dyn Balancer>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§