Class GELattice

  • public class GELattice
    extends java.lang.Object
    Runs the dynamic programming algorithm of [Mann and McCallum 08] for computing the gradient of a Generalized Expectation constraint that considers a single label of a linear chain CRF. See: "Generalized Expectation Criteria for Semi-Supervised Learning of Conditional Random Fields" Gideon Mann and Andrew McCallum ACL 2008 gdruck NOTE: This new version of GE Lattice that computes the gradient for all constraints simultaneously!
    Gregory Druck, Gaurav Chandalia, Gideon Mann
    • Field Detail

      • latticeLength

        protected int latticeLength
      • numStates

        protected int numStates
      • dotCache

        protected LogNumber[][][] dotCache
    • Constructor Detail

      • GELattice

        public GELattice​(FeatureVectorSequence fvs,
                         double[][] gammas,
                         double[][][] xis,
                         Transducer transducer,
                         int[][] reverseTrans,
                         int[][] reverseTransIndices,
                         CRF.Factors gradient,
                         java.util.ArrayList<GEConstraint> constraints,
                         boolean check)
        fvs - Input FeatureVectorSequence
        gammas - Marginals over single states
        xis - Marginals over pairs of states
        transducer - Transducer
        reverseTrans - Source state indices for each destination state
        reverseTransIndices - Transition indices for each destination state
        gradient - Gradient to increment
        constraints - List of constraints
        check - Whether to run the debugging test to verify correctness (will be much slower if true)
    • Method Detail

      • check

        public void check​(java.util.ArrayList<GEConstraint> constraints,
                          double[][] gammas,
                          double[][][] xis,
                          FeatureVectorSequence fvs)
        Verifies the correctness of the lattice computations.
      • getAlpha

        public LogNumber getAlpha​(int ip,
                                  int s1,
                                  int s2)
      • getBeta

        public LogNumber getBeta​(int ip,
                                 int s1,
                                 int s2)