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§
Sourcefn samples_seen(&self) -> u64
fn samples_seen(&self) -> u64
How many training samples the model has seen so far.
Sourcefn predict(&self, features: &SparseFeatures) -> Result<f64, RillError>
fn predict(&self, features: &SparseFeatures) -> Result<f64, RillError>
Predict the target for the given sparse features.
This method must not modify the model.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".