cc.mallet.fst.semi_supervised
Class GELattice

java.lang.Object
  extended by cc.mallet.fst.semi_supervised.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

Author:
Gregory Druck, Gaurav Chandalia

Nested Class Summary
protected  class GELattice.LatticeNode
          Contains forward-backward vectors correspoding to an input position and a state index.
 
Field Summary
protected  GELattice.LatticeNode[][] lattice
           
protected  int latticeLength
           
protected  int numStates
           
protected  Transducer transducer
           
protected  double[][][] transGradientCache
           
 
Constructor Summary
GELattice(FeatureVectorSequence fvs, double[][] gammas, double[][][] xis, Transducer transducer, Transducer.Incrementor incrementor, GECriteria geCriteria, boolean check)
           
 
Method Summary
 void check(double[][] gammas, double[][][] xis, int li, int fi, FeatureVectorSequence fvs)
          Verifies the correctness of the lattice computations.
static double logValueOfIndicatorFeature(FeatureVectorSequence fvs, int fi, int ip)
          Returns indicator value of feature at specified position in logspace.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

latticeLength

protected int latticeLength

transducer

protected Transducer transducer

numStates

protected int numStates

lattice

protected GELattice.LatticeNode[][] lattice

transGradientCache

protected double[][][] transGradientCache
Constructor Detail

GELattice

public GELattice(FeatureVectorSequence fvs,
                 double[][] gammas,
                 double[][][] xis,
                 Transducer transducer,
                 Transducer.Incrementor incrementor,
                 GECriteria geCriteria,
                 boolean check)
Method Detail

logValueOfIndicatorFeature

public static final double logValueOfIndicatorFeature(FeatureVectorSequence fvs,
                                                      int fi,
                                                      int ip)
Returns indicator value of feature at specified position in logspace.

Returns: 0.0 for log(1), Transducer.IMPOSSIBLE_WEIGHT for log(0).


check

public void check(double[][] gammas,
                  double[][][] xis,
                  int li,
                  int fi,
                  FeatureVectorSequence fvs)
Verifies the correctness of the lattice computations.