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]
fn new() -> NaiveBayes<T>
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();
fn cluster_count(&self) -> Option<&usize>
Get the cluster count for this model.
Returns an option which is None
until the model has been trained.
fn class_prior(&self) -> Option<&Vec<f64>>
Get the class prior distribution for this model.
Returns an option which is None
until the model has been trained.
fn distr(&self) -> Option<&T>
Get the distribution for this model.
Returns an option which is None
until the model has been trained.
impl<T: Distribution> NaiveBayes<T>
[src]
fn get_log_probs(&self, inputs: &Matrix<f64>) -> LearningResult<Matrix<f64>>
Get the log-probabilities per class for each input.
Trait Implementations
impl<T: Debug + Distribution> Debug for NaiveBayes<T>
[src]
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.