Struct rusty_machine::learning::naive_bayes::NaiveBayes [] [src]

pub struct NaiveBayes<T: Distribution> { /* fields omitted */ }

The Naive Bayes model.

Methods

impl<T: Distribution> NaiveBayes<T>
[src]

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.

impl<T: Distribution> NaiveBayes<T>
[src]

Get the log-probabilities per class for each input.

Trait Implementations

impl<T: Debug + Distribution> Debug for NaiveBayes<T>
[src]

Formats the value using the given formatter.

impl<T: Distribution> SupModel<Matrix<f64>, Matrix<f64>> for NaiveBayes<T>
[src]

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.