Class GISTrainer

All Implemented Interfaces:
Trainer, EventTrainer

public class GISTrainer extends AbstractEventTrainer
An implementation of Generalized Iterative Scaling (GIS).

The reference paper for this implementation was Adwait Ratnaparkhi's tech report at the University of Pennsylvania's Institute for Research in Cognitive Science, and is available at ftp://ftp.cis.upenn.edu/pub/ircs/tr/97-08.ps.Z.

The slack parameter used in the above implementation has been removed by default from the computation and a method for updating with Gaussian smoothing has been added per Investigating GIS and Smoothing for Maximum Entropy Taggers, Clark and Curran (2002). http://acl.ldc.upenn.edu/E/E03/E03-1071.pdf.

The slack parameter can be used by setting useSlackParameter to true. Gaussian smoothing can be used by setting useGaussianSmoothing to true.

A Prior can be used to train models which converge to the distribution which minimizes the relative entropy between the distribution specified by the empirical constraints of the training data and the specified prior. By default, the uniform distribution is used as the prior.

  • Field Details

    • logger

      private static final org.slf4j.Logger logger
    • LOG_LIKELIHOOD_THRESHOLD_PARAM

      public static final String LOG_LIKELIHOOD_THRESHOLD_PARAM
      See Also:
    • LOG_LIKELIHOOD_THRESHOLD_DEFAULT

      public static final double LOG_LIKELIHOOD_THRESHOLD_DEFAULT
      See Also:
    • llThreshold

      private double llThreshold
    • useSimpleSmoothing

      private boolean useSimpleSmoothing
      Specifies whether unseen context/outcome pairs should be estimated as occur very infrequently.
    • useGaussianSmoothing

      private boolean useGaussianSmoothing
      Specified whether parameter updates should prefer a distribution of parameters which is gaussian.
    • sigma

      private double sigma
    • _smoothingObservation

      private double _smoothingObservation
    • numUniqueEvents

      private int numUniqueEvents
      Number of unique events which occurred 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 associated 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.
    • observedExpects

      private MutableContext[] observedExpects
      Stores the observed expected values of the features based on training data.
    • params

      private MutableContext[] params
      Stores the estimated parameter value of each predicate during iteration
    • modelExpects

      private MutableContext[][] modelExpects
      Stores the expected values of the features based on the current models
    • prior

      private Prior prior
      This is the prior distribution that the model uses for training.
    • evalParams

      private EvalParameters evalParams
      Initial probability for all outcomes.
    • MAXENT_VALUE

      public static final String MAXENT_VALUE
      See Also:
    • SMOOTHING_PARAM

      private static final String SMOOTHING_PARAM
      If we are using smoothing, this is used as the "number" of times we want the trainer to imagine that it saw a feature that it actually didn't see. Defaulted to 0.1.
      See Also:
    • SMOOTHING_DEFAULT

      private static final boolean SMOOTHING_DEFAULT
      See Also:
    • SMOOTHING_OBSERVATION_PARAM

      private static final String SMOOTHING_OBSERVATION_PARAM
      See Also:
    • SMOOTHING_OBSERVATION

      private static final double SMOOTHING_OBSERVATION
      See Also:
    • GAUSSIAN_SMOOTHING_PARAM

      private static final String GAUSSIAN_SMOOTHING_PARAM
      See Also:
    • GAUSSIAN_SMOOTHING_DEFAULT

      private static final boolean GAUSSIAN_SMOOTHING_DEFAULT
      See Also:
    • GAUSSIAN_SMOOTHING_SIGMA_PARAM

      private static final String GAUSSIAN_SMOOTHING_SIGMA_PARAM
      See Also:
    • GAUSSIAN_SMOOTHING_SIGMA_DEFAULT

      private static final double GAUSSIAN_SMOOTHING_SIGMA_DEFAULT
      See Also:
  • Constructor Details

    • GISTrainer

      public GISTrainer()
      Initializes a GISTrainer.

      Note:
      The resulting instance does not print progress messages about training to STDOUT.

  • Method Details