Trait NaiveBayes

Source
pub trait NaiveBayes<'a, F, L>
where F: Float, L: Label + Ord,
{ // Required method fn joint_log_likelihood( &self, x: ArrayView2<'_, F>, ) -> HashMap<&L, Array1<F>>; // Provided methods fn predict_log_proba(&self, x: ArrayView2<'_, F>) -> (Array2<F>, Vec<&L>) { ... } fn predict_proba(&self, x: ArrayView2<'_, F>) -> (Array2<F>, Vec<&L>) { ... } }

Required Methods§

Source

fn joint_log_likelihood(&self, x: ArrayView2<'_, F>) -> HashMap<&L, Array1<F>>

Compute the unnormalized posterior log probabilities. The result is returned as an HashMap indexing log probabilities for each samples (eg x rows) by classes (eg jll[class] -> (n_samples,) array)

Provided Methods§

Source

fn predict_log_proba(&self, x: ArrayView2<'_, F>) -> (Array2<F>, Vec<&L>)

Compute log-probability estimates for each sample wrt classes. The columns corresponds to classes in sorted order returned as the second output.

Source

fn predict_proba(&self, x: ArrayView2<'_, F>) -> (Array2<F>, Vec<&L>)

Compute probability estimates for each sample wrt classes. The columns corresponds to classes in sorted order returned as the second output.

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<F, L> NaiveBayes<'_, F, L> for BernoulliNb<F, L>
where F: Float, L: Label + Ord,

Source§

impl<F, L> NaiveBayes<'_, F, L> for GaussianNb<F, L>
where F: Float, L: Label + Ord,

Source§

impl<F, L> NaiveBayes<'_, F, L> for MultinomialNb<F, L>
where F: Float, L: Label + Ord,