pub trait SparseClassifier {
// Required methods
fn samples_seen(&self) -> u64;
fn predict_proba(&self, features: &SparseFeatures) -> Result<f64, RillError>;
fn learn(
&mut self,
features: &SparseFeatures,
target: bool,
) -> Result<(), RillError>;
fn reset(&mut self);
// Provided method
fn predict(&self, features: &SparseFeatures) -> Result<bool, RillError> { ... }
}Expand description
An online binary classifier that accepts sparse features.
predict (and predict_proba) must be 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_proba(&self, features: &SparseFeatures) -> Result<f64, RillError>
fn predict_proba(&self, features: &SparseFeatures) -> Result<f64, RillError>
Predict the probability of the positive class.
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".