pub struct NaiveBayes<T: Distribution> { /* private fields */ }
Expand description

The Naive Bayes model.

Implementations

Create a new NaiveBayes model from a given distribution.

Examples
use rusty_machine::learning::naive_bayes::{NaiveBayes, Gaussian};

// Create a new Gaussian Naive Bayes model.
let _ = NaiveBayes::<Gaussian>::new();

Get the cluster count for this model.

Returns an option which is None until the model has been trained.

Get the class prior distribution for this model.

Returns an option which is None until the model has been trained.

Get the distribution for this model.

Returns an option which is None until the model has been trained.

Get the log-probabilities per class for each input.

Trait Implementations

Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more

Train and predict from the Naive Bayes model.

The input matrix must be rows made up of features. The target matrix should have indicator vectors in each row specifying the input class. e.g. [[1,0,0],[0,0,1]] shows class 1 first, then class 3.

Train the model using inputs and targets.

Predict output from inputs.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.