Package cc.mallet.fst.semi_supervised
Class CRFOptimizableByGE
- java.lang.Object
-
- 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
Constructors Constructor Description 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcacheValueAndGradient()voidcreateReverseTransitionMatrices(CRF crf)Initializes data structures for mapping between a destination state and its source states / transition indices.intgetNumParameters()doublegetParameter(int index)voidgetParameters(double[] buffer)doublegetValue()voidgetValueGradient(double[] buffer)voidsetGaussianPriorVariance(double variance)voidsetParameter(int index, double value)voidsetParameters(double[] params)voidshutdown()Should be called after training is complete to shutdown all threads.
-
-
-
Constructor Detail
-
CRFOptimizableByGE
public CRFOptimizableByGE(CRF crf, java.util.ArrayList<GEConstraint> constraints, InstanceList data, StateLabelMap map, int numThreads)
- Parameters:
crf- CRFconstraints- List of GEConstraintsdata- 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:
getNumParametersin interfaceOptimizable
-
getParameters
public void getParameters(double[] buffer)
- Specified by:
getParametersin interfaceOptimizable
-
getParameter
public double getParameter(int index)
- Specified by:
getParameterin interfaceOptimizable
-
setParameters
public void setParameters(double[] params)
- Specified by:
setParametersin interfaceOptimizable
-
setParameter
public void setParameter(int index, double value)- Specified by:
setParameterin interfaceOptimizable
-
cacheValueAndGradient
public void cacheValueAndGradient()
-
setGaussianPriorVariance
public void setGaussianPriorVariance(double variance)
-
getValueGradient
public void getValueGradient(double[] buffer)
- Specified by:
getValueGradientin interfaceOptimizable.ByGradientValue
-
getValue
public double getValue()
- Specified by:
getValuein interfaceOptimizable.ByGradientValue
-
shutdown
public void shutdown()
Should be called after training is complete to shutdown all threads.
-
-