Package ai.sklearn4j.naive_bayes
Class GaussianNaiveBayes
- java.lang.Object
-
- ai.sklearn4j.base.ClassifierMixin
-
- ai.sklearn4j.naive_bayes.BaseNaiveBayes
-
- ai.sklearn4j.naive_bayes.GaussianNaiveBayes
-
public class GaussianNaiveBayes extends BaseNaiveBayes
Naive Bayes classifier for normal distributed models.
-
-
Field Summary
-
Fields inherited from class ai.sklearn4j.base.ClassifierMixin
classCounts, classes
-
-
Constructor Summary
Constructors Constructor Description GaussianNaiveBayes()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NumpyArray<Double>getClassPriors()Gets the class priors.NumpyArray<Double>getPriors()Gets the priors.NumpyArray<Double>getSigma()Gets the variance of the features.NumpyArray<Double>getTheta()Gets the mean of the features.protected NumpyArray<Double>jointLogLikelihood(NumpyArray<Double> x)Compute the unnormalized posterior log probability of X.voidsetClassPriors(NumpyArray<Double> classPriors)Sets the class priors.voidsetPriors(NumpyArray<Double> priors)Sets the priors.voidsetSigma(NumpyArray<Double> sigma)Sets the variance of the features.voidsetTheta(NumpyArray<Double> theta)Sets the mean of the features.-
Methods inherited from class ai.sklearn4j.naive_bayes.BaseNaiveBayes
predict, predictLogProbabilities, predictProbabilities
-
Methods inherited from class ai.sklearn4j.base.ClassifierMixin
getClassCounts, getClasses, getFeatureNamesIn, getNumberOfFeatures, setClassCounts, setClasses, setFeatureNamesIn, setNumberOfFeatures
-
-
-
-
Method Detail
-
jointLogLikelihood
protected NumpyArray<Double> jointLogLikelihood(NumpyArray<Double> x)
Compute the unnormalized posterior log probability of X.I.e. ``log P(c) + log P(x|c)`` for all rows x of X, as an array-like of shape (n_samples, n_classes).
predict, predictProbabilities, and predictLogProbabilities pass the input over to jointLogLikelihood.
- Specified by:
jointLogLikelihoodin classBaseNaiveBayes- Parameters:
x- An array-like of shape (n_samples, n_classes).- Returns:
- The unnormalized posterior log probability of X.
-
getClassPriors
public NumpyArray<Double> getClassPriors()
Gets the class priors.- Returns:
- The value of class priors.
-
setClassPriors
public void setClassPriors(NumpyArray<Double> classPriors)
Sets the class priors.- Parameters:
classPriors- New value to be stored.
-
getPriors
public NumpyArray<Double> getPriors()
Gets the priors.- Returns:
- The value of priors.
-
setPriors
public void setPriors(NumpyArray<Double> priors)
Sets the priors.- Parameters:
priors- New value to be stored.
-
getSigma
public NumpyArray<Double> getSigma()
Gets the variance of the features.- Returns:
- The value of variance of the features.
-
setSigma
public void setSigma(NumpyArray<Double> sigma)
Sets the variance of the features.- Parameters:
sigma- New value to be stored.
-
getTheta
public NumpyArray<Double> getTheta()
Gets the mean of the features.- Returns:
- The value of mean of the features.
-
setTheta
public void setTheta(NumpyArray<Double> theta)
Sets the mean of the features.- Parameters:
theta- New value to be stored.
-
-