Package ai.sklearn4j.naive_bayes
Class BaseNaiveBayes
- java.lang.Object
-
- ai.sklearn4j.base.ClassifierMixin
-
- ai.sklearn4j.naive_bayes.BaseNaiveBayes
-
- Direct Known Subclasses:
BernoulliNaiveBayes,CategoricalNaiveBayes,ComplementNaiveBayes,GaussianNaiveBayes,MultinomialNaiveBayes
public abstract class BaseNaiveBayes extends ClassifierMixin
Abstract base class for naive Bayes estimators
-
-
Field Summary
-
Fields inherited from class ai.sklearn4j.base.ClassifierMixin
classCounts, classes
-
-
Constructor Summary
Constructors Constructor Description BaseNaiveBayes()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract NumpyArray<Double>jointLogLikelihood(NumpyArray<Double> x)Compute the unnormalized posterior log probability of X.NumpyArray<Long>predict(NumpyArray<Double> x)Perform classification on an array of test vectors X.NumpyArray<Double>predictLogProbabilities(NumpyArray<Double> x)Return log-probability estimates for the test vector X.NumpyArray<Double>predictProbabilities(NumpyArray<Double> x)Return probability estimates for the test vector X.-
Methods inherited from class ai.sklearn4j.base.ClassifierMixin
getClassCounts, getClasses, getFeatureNamesIn, getNumberOfFeatures, setClassCounts, setClasses, setFeatureNamesIn, setNumberOfFeatures
-
-
-
-
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:
predictin classClassifierMixin- 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:
predictLogProbabilitiesin classClassifierMixin- 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:
predictProbabilitiesin classClassifierMixin- 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_`.
-
-