Skip to main content

MLModel

Trait MLModel 

Source
pub trait MLModel:
    Debug
    + Send
    + Sync {
    // Required methods
    fn train(&mut self, data: &[MLTrainingPoint]) -> Result<()>;
    fn predict(&self, features: &[f64]) -> Result<f64>;
    fn update(&mut self, point: &MLTrainingPoint) -> Result<()>;
    fn name(&self) -> &str;
    fn metrics(&self) -> ModelMetrics;
}
Expand description

ML model trait

Required Methods§

Source

fn train(&mut self, data: &[MLTrainingPoint]) -> Result<()>

Train the model with data

Source

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

Predict anomaly score for features

Source

fn update(&mut self, point: &MLTrainingPoint) -> Result<()>

Update model with new data point

Source

fn name(&self) -> &str

Get model name

Source

fn metrics(&self) -> ModelMetrics

Get model metrics

Implementors§