[][src]Module smartcore::naive_bayes::gaussian

Gaussian Naive Bayes

Gaussian Naive Bayes is a variant of Naive Bayes for the data that follows Gaussian distribution and it supports continuous valued features conforming to a normal distribution.

Example:

use smartcore::linalg::naive::dense_matrix::*;
use smartcore::naive_bayes::gaussian::GaussianNB;

let x = DenseMatrix::from_2d_array(&[
             &[-1., -1.],
             &[-2., -1.],
             &[-3., -2.],
             &[ 1.,  1.],
             &[ 2.,  1.],
             &[ 3.,  2.],
         ]);
let y = vec![1., 1., 1., 2., 2., 2.];

let nb = GaussianNB::fit(&x, &y, Default::default()).unwrap();
let y_hat = nb.predict(&x).unwrap();

Structs

GaussianNB

GaussianNB implements the categorical naive Bayes algorithm for categorically distributed data.

GaussianNBParameters

GaussianNB parameters. Use Default::default() for default values.