Skip to main content

SparseRegressor

Trait SparseRegressor 

Source
pub trait SparseRegressor {
    // Required methods
    fn samples_seen(&self) -> u64;
    fn predict(&self, features: &SparseFeatures) -> Result<f64, RillError>;
    fn learn(
        &mut self,
        features: &SparseFeatures,
        target: f64,
    ) -> Result<(), RillError>;
    fn reset(&mut self);
}
Expand description

An online regressor that accepts sparse features.

Implementations must keep predict side-effect free.

Required Methods§

Source

fn samples_seen(&self) -> u64

How many training samples the model has seen so far.

Source

fn predict(&self, features: &SparseFeatures) -> Result<f64, RillError>

Predict the target for the given sparse features.

This method must not modify the model.

Source

fn learn( &mut self, features: &SparseFeatures, target: f64, ) -> Result<(), RillError>

Update the model using a single labeled sparse sample.

Source

fn reset(&mut self)

Reset the model to its initial state.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§