Package opennlp.tools.ml.perceptron
Class SimplePerceptronSequenceTrainer
java.lang.Object
opennlp.tools.ml.AbstractTrainer
opennlp.tools.ml.AbstractEventModelSequenceTrainer
opennlp.tools.ml.perceptron.SimplePerceptronSequenceTrainer
- All Implemented Interfaces:
EventModelSequenceTrainer
Trains models for sequences using the perceptron algorithm. Each outcome is represented as
a binary perceptron classifier. This supports standard (integer) weighting as well
average weighting. Sequence information is used in a simplified was to that described in:
Discriminative Training Methods for Hidden Markov Models: Theory and Experiments
with the Perceptron Algorithm. Michael Collins, EMNLP 2002.
Specifically only updates are applied to tokens which were incorrectly tagged by a sequence tagger
rather than to all feature across the sequence which differ from the training sequence.
-
Field Summary
FieldsFields inherited from class opennlp.tools.ml.AbstractTrainer
ALGORITHM_PARAM, CUTOFF_DEFAULT, CUTOFF_PARAM, ITERATIONS_DEFAULT, ITERATIONS_PARAM, TRAINER_TYPE_PARAM, VERBOSE_DEFAULT, VERBOSE_PARAMFields inherited from interface opennlp.tools.ml.EventModelSequenceTrainer
SEQUENCE_VALUE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoTrain(SequenceStream events) booleanisValid()Deprecated.voidnextIteration(int iteration) trainModel(int iterations, SequenceStream sequenceStream, int cutoff, boolean useAverage) voidvalidate()Check parameters.Methods inherited from class opennlp.tools.ml.AbstractEventModelSequenceTrainer
trainMethods inherited from class opennlp.tools.ml.AbstractTrainer
getAlgorithm, getCutoff, getIterations, init, initMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface opennlp.tools.ml.EventModelSequenceTrainer
init, init
-
Field Details
-
PERCEPTRON_SEQUENCE_VALUE
- See Also:
-
-
Constructor Details
-
SimplePerceptronSequenceTrainer
public SimplePerceptronSequenceTrainer()
-
-
Method Details
-
validate
public void validate()Description copied from class:AbstractTrainerCheck parameters. If subclass overrides this, it should call super.validate();- Overrides:
validatein classAbstractTrainer
-
isValid
Deprecated.- Overrides:
isValidin classAbstractTrainer- Returns:
-
doTrain
- Specified by:
doTrainin classAbstractEventModelSequenceTrainer- Throws:
IOException
-
trainModel
public AbstractModel trainModel(int iterations, SequenceStream sequenceStream, int cutoff, boolean useAverage) throws IOException - Throws:
IOException
-
nextIteration
- Throws:
IOException
-