Trait Classifier

Source
pub trait Classifier<Features, Label: Eq + Clone>
where Self: Sized,
{ // Required methods fn fit<I>(arr: &Features, y: I) -> Option<Self> where for<'a> &'a I: IntoIterator<Item = &'a Label>; fn labels(&self) -> &[Label]; fn predict_proba(&self, arr: &Features) -> Option<Array2<f64>>; // Provided method fn predict(&self, arr: &Features) -> Option<Vec<Label>> { ... } }
Expand description

Trait to make a classification model.

Required Methods§

Source

fn fit<I>(arr: &Features, y: I) -> Option<Self>
where for<'a> &'a I: IntoIterator<Item = &'a Label>,

Fit data based on given input features and labels.

Source

fn labels(&self) -> &[Label]

Labels on which the model is fitted.

Source

fn predict_proba(&self, arr: &Features) -> Option<Array2<f64>>

Predicts likelihood of each class per record. rows correspond to each record, columns are in the same order as label function.

Provided Methods§

Source

fn predict(&self, arr: &Features) -> Option<Vec<Label>>

Provided function which returns the most likely class per record.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<Label: Eq + Clone> Classifier<ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>, Label> for GaussianNB<Label>