public static class NaiveBayes.Trainer extends ClassifierTrainer<double[]>
Constructor and Description |
---|
NaiveBayes.Trainer(NaiveBayes.Model model,
double[] priori,
int p)
Constructor.
|
NaiveBayes.Trainer(NaiveBayes.Model model,
int k,
int p)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
setPriori(double[] priori)
Sets a priori probabilities of each class.
|
void |
setSmooth(double sigma)
Sets add-k prior count of terms for smoothing.
|
NaiveBayes |
train(double[][] x,
int[] y)
Learns a classifier with given training data.
|
setAttributes
public NaiveBayes.Trainer(NaiveBayes.Model model, int k, int p)
model
- the generation model of naive Bayes classifier.k
- the number of classes.p
- the dimensionality of input space.public NaiveBayes.Trainer(NaiveBayes.Model model, double[] priori, int p)
model
- the generation model of naive Bayes classifier.priori
- a priori probabilities of each class.p
- the dimensionality of input space.public void setPriori(double[] priori)
priori
- a priori probabilities of each class.public void setSmooth(double sigma)
sigma
- the prior count of add-k smoothing of evidence.public NaiveBayes train(double[][] x, int[] y)
ClassifierTrainer
train
in class ClassifierTrainer<double[]>
x
- the training instances.y
- the training labels.Copyright © 2015. All rights reserved.