Class NaiveBayes
java.lang.Object
ai.beestream.jitnn.ml.NaiveBayes
Naive Bayes classifiers after scikit-learn's GaussianNB (per-class means and variances, the
variances smoothed by varSmoothing times the largest feature variance) and MultinomialNB
(feature counts with additive smoothing alpha). Class priors are the class frequencies.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumWhich likelihood the features follow. -
Constructor Summary
ConstructorsConstructorDescriptionNaiveBayes(NaiveBayes.Kind kind, float smoothing) smoothing: varSmoothing (Gaussian, scikit-learn's 1e-9) or alpha (multinomial, 1). -
Method Summary
Modifier and TypeMethodDescriptionMultinomial: the per-class log probabilities of the features [classes, features].Fits samples x [n, features] (counts for the multinomial kind) and labels y.Joint log-likelihood [m, c].int[]The most probable label of each sample.Class probabilities [n, classes] for samples x.theta()Gaussian: the per-class feature means [classes, features].var()Gaussian: the per-class feature variances [classes, features], smoothed.
-
Constructor Details
-
NaiveBayes
smoothing: varSmoothing (Gaussian, scikit-learn's 1e-9) or alpha (multinomial, 1).
-
-
Method Details
-
fit
Fits samples x [n, features] (counts for the multinomial kind) and labels y. -
jointLogLikelihood
-
predictProba
-
predict
The most probable label of each sample. -
theta
Gaussian: the per-class feature means [classes, features]. -
var
Gaussian: the per-class feature variances [classes, features], smoothed. -
featureLogProb
Multinomial: the per-class log probabilities of the features [classes, features].
-