cc.mallet.fst.semi_supervised
Class CRFOptimizableByGE

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

Nested Class Summary
 
Nested classes/interfaces inherited from interface cc.mallet.optimize.Optimizable
Optimizable.ByBatchGradient, Optimizable.ByCombiningBatchGradient, Optimizable.ByGISUpdate, Optimizable.ByGradient, Optimizable.ByGradientValue, Optimizable.ByHessian, Optimizable.ByValue, Optimizable.ByVotedPerceptron
 
Constructor Summary
CRFOptimizableByGE(CRF crf, java.util.ArrayList<GEConstraint> constraints, InstanceList data, StateLabelMap map, int numThreads)
           
CRFOptimizableByGE(CRF crf, java.util.ArrayList<GEConstraint> constraints, InstanceList data, StateLabelMap map, int numThreads, double weight)
           
 
Method Summary
 void cacheValueAndGradient()
           
 void createReverseTransitionMatrices(CRF crf)
          Initializes data structures for mapping between a destination state and its source states / transition indices.
 int getNumParameters()
           
 double getParameter(int index)
           
 void getParameters(double[] buffer)
           
 double getValue()
           
 void getValueGradient(double[] buffer)
           
 void setGaussianPriorVariance(double variance)
           
 void setParameter(int index, double value)
           
 void setParameters(double[] params)
           
 void shutdown()
          Should be called after training is complete to shutdown all threads.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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)

CRFOptimizableByGE

public CRFOptimizableByGE(CRF crf,
                          java.util.ArrayList<GEConstraint> constraints,
                          InstanceList data,
                          StateLabelMap map,
                          int numThreads,
                          double weight)
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

getNumParameters

public int getNumParameters()
Specified by:
getNumParameters in interface Optimizable

getParameters

public void getParameters(double[] buffer)
Specified by:
getParameters in interface Optimizable

getParameter

public double getParameter(int index)
Specified by:
getParameter in interface Optimizable

setParameters

public void setParameters(double[] params)
Specified by:
setParameters in interface Optimizable

setParameter

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

cacheValueAndGradient

public void cacheValueAndGradient()

setGaussianPriorVariance

public void setGaussianPriorVariance(double variance)

getValueGradient

public void getValueGradient(double[] buffer)
Specified by:
getValueGradient in interface Optimizable.ByGradientValue

getValue

public double getValue()
Specified by:
getValue in interface Optimizable.ByGradientValue

shutdown

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