pub trait Classifier {
// Required methods
fn train(
&mut self,
x_train: &Array2<f64>,
y_train: &Array1<f64>,
) -> Result<()>;
fn predict(&self, x: &Array1<f64>) -> Result<usize>;
fn predict_proba(&self, x: &Array1<f64>) -> Result<Array1<f64>>;
fn evaluate(
&self,
x_test: &Array2<f64>,
y_test: &Array1<f64>,
) -> Result<ClassificationMetrics>;
// Provided method
fn predict_batch(&self, x: &Array2<f64>) -> Result<Array1<usize>> { ... }
}
Expand description
Trait for classification models
Required Methods§
Sourcefn train(&mut self, x_train: &Array2<f64>, y_train: &Array1<f64>) -> Result<()>
fn train(&mut self, x_train: &Array2<f64>, y_train: &Array1<f64>) -> Result<()>
Trains the classifier on a dataset