Class CRFOptimizableByGE

  • All Implemented Interfaces:
    Optimizable, Optimizable.ByGradientValue

    public class CRFOptimizableByGE
    extends java.lang.Object
    implements Optimizable.ByGradientValue
    Optimizable for CRF using Generalized Expectation constraints that consider either a single label or a pair of labels of a linear chain CRF. See: "Generalized Expectation Criteria for Semi-Supervised Learning of Conditional Random Fields" Gideon Mann and Andrew McCallum ACL 2008
    Author:
    Gregory Druck
    • Constructor Detail

      • CRFOptimizableByGE

        public CRFOptimizableByGE​(CRF crf,
                                  java.util.ArrayList<GEConstraint> constraints,
                                  InstanceList data,
                                  StateLabelMap map,
                                  int numThreads)
        Parameters:
        crf - CRF
        constraints - List of GEConstraints
        data - Unlabeled data.
        map - Map between states and labels.
        numThreads - Number of threads to use for training (DEFAULT=1)
    • Method Detail

      • createReverseTransitionMatrices

        public void createReverseTransitionMatrices​(CRF crf)
        Initializes data structures for mapping between a destination state and its source states / transition indices.
        Parameters:
        crf - CRF
      • setParameter

        public void setParameter​(int index,
                                 double value)
        Specified by:
        setParameter in interface Optimizable
      • cacheValueAndGradient

        public void cacheValueAndGradient()
      • setGaussianPriorVariance

        public void setGaussianPriorVariance​(double variance)
      • shutdown

        public void shutdown()
        Should be called after training is complete to shutdown all threads.