Class PerceptronTrainer

All Implemented Interfaces:
Trainer, EventTrainer

public class PerceptronTrainer extends AbstractEventTrainer
Trains models using the perceptron algorithm.

Each outcome is represented as a binary perceptron classifier. This supports standard (integer) weighting as well average weighting as described in:

Discriminative Training Methods for Hidden Markov Models: Theory and Experiments with the Perceptron Algorithm. Michael Collins, EMNLP 2002.

See Also:
  • Field Details

    • logger

      private static final org.slf4j.Logger logger
    • PERCEPTRON_VALUE

      public static final String PERCEPTRON_VALUE
      See Also:
    • TOLERANCE_DEFAULT

      public static final double TOLERANCE_DEFAULT
      See Also:
    • numUniqueEvents

      private int numUniqueEvents
      Number of unique events which occurred in the event set.
    • numEvents

      private int numEvents
      Number of events in the event set.
    • numPreds

      private int numPreds
      Number of predicates.
    • numOutcomes

      private int numOutcomes
      Number of outcomes.
    • contexts

      private int[][] contexts
      Records the array of predicates seen in each event.
    • values

      private float[][] values
      The value associates with each context. If null then context values are assumes to be 1.
    • outcomeList

      private int[] outcomeList
      List of outcomes for each event i, in context[i].
    • numTimesEventsSeen

      private int[] numTimesEventsSeen
      Records the num of times an event has been seen for each event i, in context[i].
    • outcomeLabels

      private String[] outcomeLabels
      Stores the String names of the outcomes. The GIS only tracks outcomes as ints, and so this array is needed to save the model to disk and thereby allow users to know what the outcome was in human understandable terms.
    • predLabels

      private String[] predLabels
      Stores the String names of the predicates. The GIS only tracks predicates as ints, and so this array is needed to save the model to disk and thereby allow users to know what the outcome was in human understandable terms.
    • tolerance

      private double tolerance
    • stepSizeDecrease

      private Double stepSizeDecrease
    • useSkippedlAveraging

      private boolean useSkippedlAveraging
  • Constructor Details

  • Method Details