Struct smartcore::naive_bayes::gaussian::GaussianNB
source · pub struct GaussianNB<TX: Number + RealNumber, TY: Number + Ord + Unsigned, X: Array2<TX>, Y: Array1<TY>> { /* private fields */ }
Expand description
GaussianNB implements the naive Bayes algorithm for data that follows the Gaussian distribution.
Implementations§
source§impl<TX: Number + RealNumber, TY: Number + Ord + Unsigned, X: Array2<TX>, Y: Array1<TY>> GaussianNB<TX, TY, X, Y>
impl<TX: Number + RealNumber, TY: Number + Ord + Unsigned, X: Array2<TX>, Y: Array1<TY>> GaussianNB<TX, TY, X, Y>
sourcepub fn fit(
x: &X,
y: &Y,
parameters: GaussianNBParameters
) -> Result<Self, Failed>
pub fn fit( x: &X, y: &Y, parameters: GaussianNBParameters ) -> Result<Self, Failed>
Fits GaussianNB with given data
x
- training data of size NxM where N is the number of samples and M is the number of features.y
- vector with target values (classes) of length N.parameters
- additional parameters like class priors.
sourcepub fn predict(&self, x: &X) -> Result<Y, Failed>
pub fn predict(&self, x: &X) -> Result<Y, Failed>
Estimates the class labels for the provided data.
x
- data of shape NxM where N is number of data points to estimate and M is number of features. Returns a vector of size N with class estimates.
sourcepub fn classes(&self) -> &Vec<TY>
pub fn classes(&self) -> &Vec<TY>
Class labels known to the classifier. Returns a vector of size n_classes.
sourcepub fn class_count(&self) -> &Vec<usize>
pub fn class_count(&self) -> &Vec<usize>
Number of training samples observed in each class. Returns a vector of size n_classes.
sourcepub fn class_priors(&self) -> &Vec<f64>
pub fn class_priors(&self) -> &Vec<f64>
Probability of each class Returns a vector of size n_classes.
Trait Implementations§
source§impl<TX: Debug + Number + RealNumber, TY: Debug + Number + Ord + Unsigned, X: Debug + Array2<TX>, Y: Debug + Array1<TY>> Debug for GaussianNB<TX, TY, X, Y>
impl<TX: Debug + Number + RealNumber, TY: Debug + Number + Ord + Unsigned, X: Debug + Array2<TX>, Y: Debug + Array1<TY>> Debug for GaussianNB<TX, TY, X, Y>
source§impl<TX: Number + RealNumber, TY: Number + Ord + Unsigned, X: Array2<TX>, Y: Array1<TY>> Display for GaussianNB<TX, TY, X, Y>
impl<TX: Number + RealNumber, TY: Number + Ord + Unsigned, X: Array2<TX>, Y: Array1<TY>> Display for GaussianNB<TX, TY, X, Y>
source§impl<TX: PartialEq + Number + RealNumber, TY: PartialEq + Number + Ord + Unsigned, X: PartialEq + Array2<TX>, Y: PartialEq + Array1<TY>> PartialEq<GaussianNB<TX, TY, X, Y>> for GaussianNB<TX, TY, X, Y>
impl<TX: PartialEq + Number + RealNumber, TY: PartialEq + Number + Ord + Unsigned, X: PartialEq + Array2<TX>, Y: PartialEq + Array1<TY>> PartialEq<GaussianNB<TX, TY, X, Y>> for GaussianNB<TX, TY, X, Y>
source§fn eq(&self, other: &GaussianNB<TX, TY, X, Y>) -> bool
fn eq(&self, other: &GaussianNB<TX, TY, X, Y>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<TX: Number + RealNumber, TY: Number + Ord + Unsigned, X: Array2<TX>, Y: Array1<TY>> Predictor<X, Y> for GaussianNB<TX, TY, X, Y>
impl<TX: Number + RealNumber, TY: Number + Ord + Unsigned, X: Array2<TX>, Y: Array1<TY>> Predictor<X, Y> for GaussianNB<TX, TY, X, Y>
source§impl<TX: Number + RealNumber, TY: Number + Ord + Unsigned, X: Array2<TX>, Y: Array1<TY>> SupervisedEstimator<X, Y, GaussianNBParameters> for GaussianNB<TX, TY, X, Y>
impl<TX: Number + RealNumber, TY: Number + Ord + Unsigned, X: Array2<TX>, Y: Array1<TY>> SupervisedEstimator<X, Y, GaussianNBParameters> for GaussianNB<TX, TY, X, Y>
impl<TX: Number + RealNumber, TY: Number + Ord + Unsigned, X: Array2<TX>, Y: Array1<TY>> StructuralPartialEq for GaussianNB<TX, TY, X, Y>
Auto Trait Implementations§
impl<TX, TY, X, Y> RefUnwindSafe for GaussianNB<TX, TY, X, Y>where TX: RefUnwindSafe, TY: RefUnwindSafe, X: RefUnwindSafe, Y: RefUnwindSafe,
impl<TX, TY, X, Y> Send for GaussianNB<TX, TY, X, Y>where TX: Send, TY: Send, X: Send, Y: Send,
impl<TX, TY, X, Y> Sync for GaussianNB<TX, TY, X, Y>where TX: Sync, TY: Sync, X: Sync, Y: Sync,
impl<TX, TY, X, Y> Unpin for GaussianNB<TX, TY, X, Y>where TX: Unpin, TY: Unpin, X: Unpin, Y: Unpin,
impl<TX, TY, X, Y> UnwindSafe for GaussianNB<TX, TY, X, Y>where TX: UnwindSafe, TY: UnwindSafe, X: UnwindSafe, Y: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more