Class MultinomialNaiveBayesTrainer
java.lang.Object
org.tribuo.classification.mnb.MultinomialNaiveBayesTrainer
- All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.config.Configurable,com.oracle.labs.mlrg.olcut.provenance.Provenancable<org.tribuo.provenance.TrainerProvenance>,org.tribuo.Trainer<Label>,org.tribuo.WeightedExamples
public class MultinomialNaiveBayesTrainer
extends Object
implements org.tribuo.Trainer<Label>, org.tribuo.WeightedExamples
A
Trainer which trains a multinomial Naive Bayes model with Laplace smoothing.
All feature values must be non-negative.
See:
Wang S, Manning CD. "Baselines and Bigrams: Simple, Good Sentiment and Topic Classification" Proceedings of the 50th Annual Meeting of the Association for Computational Linguistics, 2012.
-
Field Summary
Fields inherited from interface org.tribuo.Trainer
DEFAULT_SEED, INCREMENT_INVOCATION_COUNT -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a multinomial naive bayes trainer using a smoothing value of 1.0.MultinomialNaiveBayesTrainer(double alpha) Constructs a multinomial naive bayes trainer with the specified smoothing value. -
Method Summary
Modifier and TypeMethodDescriptionintorg.tribuo.provenance.TrainerProvenancevoidsetInvocationCount(int invocationCount) toString()org.tribuo.Model<Label> train(org.tribuo.Dataset<Label> examples, Map<String, com.oracle.labs.mlrg.olcut.provenance.Provenance> runProvenance) org.tribuo.Model<Label> train(org.tribuo.Dataset<Label> examples, Map<String, com.oracle.labs.mlrg.olcut.provenance.Provenance> runProvenance, int invocationCount) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.oracle.labs.mlrg.olcut.config.Configurable
postConfigMethods inherited from interface org.tribuo.Trainer
train
-
Constructor Details
-
MultinomialNaiveBayesTrainer
public MultinomialNaiveBayesTrainer()Constructs a multinomial naive bayes trainer using a smoothing value of 1.0. -
MultinomialNaiveBayesTrainer
Constructs a multinomial naive bayes trainer with the specified smoothing value.- Parameters:
alpha- The smoothing value.
-
-
Method Details
-
train
-
train
-
getInvocationCount
- Specified by:
getInvocationCountin interfaceorg.tribuo.Trainer<Label>
-
setInvocationCount
- Specified by:
setInvocationCountin interfaceorg.tribuo.Trainer<Label>
-
toString
-
getProvenance
- Specified by:
getProvenancein interfacecom.oracle.labs.mlrg.olcut.provenance.Provenancable<org.tribuo.provenance.TrainerProvenance>
-