public static class NaiveBayes.Trainer extends ClassifierTrainer<double[]>
| Constructor and Description |
|---|
Trainer(NaiveBayes.Model model,
double[] priori,
int p)
Constructor.
|
Trainer(NaiveBayes.Model model,
int k,
int p)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
NaiveBayes.Trainer |
setPriori(double[] priori)
Sets a priori probabilities of each class.
|
NaiveBayes.Trainer |
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.
|
setAttributespublic 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 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 NaiveBayes.Trainer setPriori(double[] priori)
priori - a priori probabilities of each class.public NaiveBayes.Trainer setSmooth(double sigma)
sigma - the prior count of add-k smoothing of evidence.public NaiveBayes train(double[][] x, int[] y)
ClassifierTrainertrain in class ClassifierTrainer<double[]>x - the training instances.y - the training labels.