Skip to main content

OnlineLearner

Trait OnlineLearner 

Source
pub trait OnlineLearner {
    // Required methods
    fn update(
        &mut self,
        features: &[f64],
        label: f64,
    ) -> Result<OnlineUpdateResult, OnlineError>;
    fn predict(&self, features: &[f64]) -> Result<f64, OnlineError>;
    fn n_updates(&self) -> usize;
    fn weights(&self) -> &[f64];
}
Expand description

Trait for online learners that update one sample at a time.

Required Methods§

Source

fn update( &mut self, features: &[f64], label: f64, ) -> Result<OnlineUpdateResult, OnlineError>

Update model on a single (features, label) pair. Returns update stats.

Source

fn predict(&self, features: &[f64]) -> Result<f64, OnlineError>

Predict class label or regression value for features.

Source

fn n_updates(&self) -> usize

Number of updates seen so far.

Source

fn weights(&self) -> &[f64]

Current weight vector (without bias).

Implementors§