Class SimplePerceptronSequenceTrainer<T>

Namespace
NOpenNLP.Tools.Ml.Perceptron
Assembly
NOpenNLP.Tools.dll

Trains models for sequences using the perceptron algorithm. Each outcome is represented as a binary perceptron classifier. This supports standard (integer) weighting as well as average weighting. Sequence information is used in a simplified way 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 features across the sequence which differ from the training sequence.

public class SimplePerceptronSequenceTrainer<T> : AbstractEventModelSequenceTrainer<T>, IEventModelSequenceTrainer<T>

Type Parameters

T

The type of the object which is the source of each sequence.

Inheritance
SimplePerceptronSequenceTrainer<T>
Implements
Inherited Members

Constructors

SimplePerceptronSequenceTrainer()

public SimplePerceptronSequenceTrainer()

Fields

PERCEPTRON_SEQUENCE_VALUE

public const string PERCEPTRON_SEQUENCE_VALUE = "PERCEPTRON_SEQUENCE"

Field Value

string

Methods

DoTrain(ISequenceStream<T>)

Trains a model from the given sequence stream.

public override IMaxentModel DoTrain(ISequenceStream<T> events)

Parameters

events ISequenceStream<T>

Returns

IMaxentModel

NextIteration(int)

public virtual void NextIteration(int iteration)

Parameters

iteration int

TrainModel(int, ISequenceStream<T>, int, bool)

public virtual AbstractModel TrainModel(int iterations, ISequenceStream<T> sequenceStream, int cutoff, bool useAverage)

Parameters

iterations int
sequenceStream ISequenceStream<T>
cutoff int
useAverage bool

Returns

AbstractModel

Validate()

Checks the parameters. If a subclass overrides this, it should call the base implementation.

public override void Validate()

Exceptions

ArgumentException

Thrown if a parameter is not valid.