Class GaussianNaiveBayes


  • public class GaussianNaiveBayes
    extends BaseNaiveBayes
    Naive Bayes classifier for normal distributed models.
    • Constructor Detail

      • GaussianNaiveBayes

        public GaussianNaiveBayes()
    • 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:
        jointLogLikelihood in class BaseNaiveBayes
        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.