Class BaseNaiveBayes

    • Constructor Detail

      • BaseNaiveBayes

        public BaseNaiveBayes()
    • Method Detail

      • jointLogLikelihood

        protected abstract 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.

        Parameters:
        x - An array-like of shape (n_samples, n_classes).
      • predict

        public NumpyArray<Long> predict​(NumpyArray<Double> x)
        Perform classification on an array of test vectors X.
        Specified by:
        predict in class ClassifierMixin
        Parameters:
        x - Array-like of shape (n_samples, n_features) The input samples.
        Returns:
        NumpyArray of shape (n_samples,) Predicted target values for X.
      • predictLogProbabilities

        public NumpyArray<Double> predictLogProbabilities​(NumpyArray<Double> x)
        Return log-probability estimates for the test vector X.
        Specified by:
        predictLogProbabilities in class ClassifierMixin
        Parameters:
        x - array-like of shape (n_samples, n_features) The input samples.
        Returns:
        array-like of shape (n_samples, n_classes) Returns the log-probability of the samples for each class in the model. The columns correspond to the classes in sorted order, as they appear in the attribute :term:`classes_`.
      • predictProbabilities

        public NumpyArray<Double> predictProbabilities​(NumpyArray<Double> x)
        Return probability estimates for the test vector X.
        Specified by:
        predictProbabilities in class ClassifierMixin
        Parameters:
        x - array-like of shape (n_samples, n_features) The input samples.
        Returns:
        array-like of shape (n_samples, n_classes) Returns the probability of the samples for each class in the model. The columns correspond to the classes in sorted order, as they appear in the attribute :term:`classes_`.