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.
-
-
Constructor Summary
Constructors Constructor Description GaussianNaiveBayes()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NumpyArray<Double>getClassCounts()Gets the class counts.NumpyArray<Long>getClasses()Gets the classes.NumpyArray<Double>getClassPriors()Gets the class priors.String[]getFeatureNamesIn()Gets the feature names.intgetNumberOfFeatures()Gets the number of features.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.voidsetClassCounts(NumpyArray<Double> classCounts)Sets the class counts.voidsetClasses(NumpyArray<Long> classes)Sets the classes.voidsetClassPriors(NumpyArray<Double> classPriors)Sets the class priors.voidsetFeatureNamesIn(String[] featureNamesIn)Sets the feature names.voidsetNumberOfFeatures(int numberOfFeatures)Sets the number of features.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
-
-
-
-
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.
-
getClassCounts
public NumpyArray<Double> getClassCounts()
Gets the class counts.- Returns:
- The value of class counts.
-
setClassCounts
public void setClassCounts(NumpyArray<Double> classCounts)
Sets the class counts.- Parameters:
classCounts- New value to be stored.
-
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.
-
getClasses
public NumpyArray<Long> getClasses()
Gets the classes.- Returns:
- The value of classes.
-
setClasses
public void setClasses(NumpyArray<Long> classes)
Sets the classes.- Parameters:
classes- 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.
-
getFeatureNamesIn
public String[] getFeatureNamesIn()
Gets the feature names.- Returns:
- The value of feature names.
-
setFeatureNamesIn
public void setFeatureNamesIn(String[] featureNamesIn)
Sets the feature names.- Parameters:
featureNamesIn- New value to be stored.
-
getNumberOfFeatures
public int getNumberOfFeatures()
Gets the number of features.- Returns:
- The value of number of features.
-
setNumberOfFeatures
public void setNumberOfFeatures(int numberOfFeatures)
Sets the number of features.- Parameters:
numberOfFeatures- 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.
-
-