Package opennlp.tools.ml.naivebayes
Class NaiveBayesTrainer
java.lang.Object
opennlp.tools.ml.AbstractTrainer
opennlp.tools.ml.AbstractEventTrainer
opennlp.tools.ml.naivebayes.NaiveBayesTrainer
- All Implemented Interfaces:
Trainer
,EventTrainer
Trains
models
using the combination of EM algorithm
and Naive Bayes classifier which is described in:
Text Classification from Labeled and Unlabeled Documents using EM Nigam, McCallum, et al. paper of 2000
- See Also:
-
Field Summary
Fields inherited from class opennlp.tools.ml.AbstractEventTrainer
DATA_INDEXER_ONE_PASS_REAL_VALUE, DATA_INDEXER_ONE_PASS_VALUE, DATA_INDEXER_PARAM, DATA_INDEXER_TWO_PASS_VALUE
Fields inherited from class opennlp.tools.ml.AbstractTrainer
ALGORITHM_PARAM, CUTOFF_DEFAULT, CUTOFF_PARAM, ITERATIONS_DEFAULT, ITERATIONS_PARAM, TRAINER_TYPE_PARAM
Fields inherited from interface opennlp.tools.ml.EventTrainer
EVENT_VALUE
-
Constructor Summary
ConstructorDescriptionInstantiates aNaiveBayesTrainer
with default training parameters.NaiveBayesTrainer
(TrainingParameters parameters) Instantiates aNaiveBayesTrainer
with specificTrainingParameters
. -
Method Summary
Modifier and TypeMethodDescriptiondoTrain
(DataIndexer indexer) boolean
Trains aNaiveBayesModel
with given parameters.Methods inherited from class opennlp.tools.ml.AbstractEventTrainer
getDataIndexer, train, train, validate
Methods inherited from class opennlp.tools.ml.AbstractTrainer
getAlgorithm, getCutoff, getIterations, init
-
Field Details
-
NAIVE_BAYES_VALUE
- See Also:
-
-
Constructor Details
-
NaiveBayesTrainer
public NaiveBayesTrainer()Instantiates aNaiveBayesTrainer
with default training parameters. -
NaiveBayesTrainer
Instantiates aNaiveBayesTrainer
with specificTrainingParameters
.- Parameters:
parameters
- Theparameter
to use.
-
-
Method Details
-
isSortAndMerge
public boolean isSortAndMerge()- Specified by:
isSortAndMerge
in classAbstractEventTrainer
-
doTrain
- Specified by:
doTrain
in classAbstractEventTrainer
- Throws:
IOException
-
trainModel
Trains aNaiveBayesModel
with given parameters.- Parameters:
di
- TheDataIndexer
used as data input.- Returns:
- A valid, trained
Naive Bayes model
.
-