public class DiscreteNaiveBayesModel extends Object implements BayesModel<DiscreteNaiveBayesModel,Vector,Double>, DeployableObject
y
belongs to a class C_k, k in [0..K]
as
p(C_k,y) =x_1*p_k1^x *...*x_i*p_ki^x_i
. Where x_i
is a discrete feature, p_ki
is a prior
probability probability of class p(x|C_k)
. Returns the number of the most possible class.Constructor and Description |
---|
DiscreteNaiveBayesModel(double[][][] probabilities,
double[] clsProbabilities,
double[] labels,
double[][] bucketThresholds,
DiscreteNaiveBayesSumsHolder sumsHolder) |
Modifier and Type | Method and Description |
---|---|
double[][] |
getBucketThresholds()
A getter for bucketThresholds.
|
double[] |
getClsProbabilities()
A getter for clsProbabilities.
|
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[][][] |
getProbabilities()
A getter for probabilities.
|
DiscreteNaiveBayesSumsHolder |
getSumsHolder()
A getter for sumsHolder.
|
Double |
predict(Vector vector)
Make a prediction for the specified input arguments.
|
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<DiscreteNaiveBayesModel,P> exporter,
P path)
Save model by the given path.
|
public DiscreteNaiveBayesModel(double[][][] probabilities, double[] clsProbabilities, double[] labels, double[][] bucketThresholds, DiscreteNaiveBayesSumsHolder sumsHolder)
probabilities
- Probabilities of features for classes.clsProbabilities
- Prior probabilities for classes.labels
- Labels.bucketThresholds
- The threshold to convert a feature to a binary value.sumsHolder
- Amount values which are abouve the threshold per label.public <P> void saveModel(Exporter<DiscreteNaiveBayesModel,P> exporter, P path)
saveModel
in interface Exportable<DiscreteNaiveBayesModel>
exporter
- Exporter.path
- Path to saved model.public Double predict(Vector vector)
Model
public double[] probabilityPowers(Vector vector)
log(probability)
to be this label.
The prior probabilities are not count.probabilityPowers
in interface BayesModel<DiscreteNaiveBayesModel,Vector,Double>
public double[][][] getProbabilities()
public double[] getClsProbabilities()
public double[][] getBucketThresholds()
public double[] getLabels()
public DiscreteNaiveBayesSumsHolder 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