public class GaussianNaiveBayesModel extends Object implements BayesModel<GaussianNaiveBayesModel,Vector,Double>, DeployableObject
y
belongs to a class C_k, k in [0..K]
as p(C_k,y) = p(C_k)*p(y_1,C_k) *...*p(y_n,C_k) / p(y)
. Return the number of the most possible class.Constructor and Description |
---|
GaussianNaiveBayesModel(double[][] means,
double[][] variances,
double[] classProbabilities,
double[] labels,
org.apache.ignite.ml.naivebayes.gaussian.GaussianNaiveBayesSumsHolder sumsHolder) |
Modifier and Type | Method and Description |
---|---|
double[] |
getClassProbabilities()
A getter for classProbabilities.
|
List<Object> |
getDependencies()
Returns dependencies of this object that can be object with class defined by client side and unknown for server.
|
double[] |
getLabels()
A getter for labels.
|
double[][] |
getMeans()
A getter for means.
|
org.apache.ignite.ml.naivebayes.gaussian.GaussianNaiveBayesSumsHolder |
getSumsHolder()
A getter for sumsHolder.
|
double[][] |
getVariances()
A getter for variances.
|
Double |
predict(Vector vector)
Returns a number of class to which the input belongs.
|
double[] |
probabilityPowers(Vector vector)
Returns an array where the index correapons a label, and value corresponds
log(probability) to be this label. |
<P> void |
saveModel(Exporter<GaussianNaiveBayesModel,P> exporter,
P path)
Save model by the given path.
|
public GaussianNaiveBayesModel(double[][] means, double[][] variances, double[] classProbabilities, double[] labels, org.apache.ignite.ml.naivebayes.gaussian.GaussianNaiveBayesSumsHolder sumsHolder)
means
- Means of features for all classes.variances
- Variances of features for all classes.classProbabilities
- Probabilities for all classes.labels
- Labels.sumsHolder
- Feature sum, squared sum and count sum per label. This data is used for future model updating.public <P> void saveModel(Exporter<GaussianNaiveBayesModel,P> exporter, P path)
saveModel
in interface Exportable<GaussianNaiveBayesModel>
exporter
- Exporter.path
- Path to saved model.public double[] probabilityPowers(Vector vector)
log(probability)
to be this label.
The prior probabilities are not count.probabilityPowers
in interface BayesModel<GaussianNaiveBayesModel,Vector,Double>
public double[][] getMeans()
public double[][] getVariances()
public double[] getClassProbabilities()
public double[] getLabels()
public org.apache.ignite.ml.naivebayes.gaussian.GaussianNaiveBayesSumsHolder getSumsHolder()
public List<Object> getDependencies()
getDependencies
in interface DeployableObject
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.9.1 Release Date : December 9 2020