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 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.
-
-
-
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:
getNumParameters
in interfaceOptimizable
-
getParameters
public void getParameters(double[] buffer)
- Specified by:
getParameters
in interfaceOptimizable
-
getParameter
public double getParameter(int index)
- Specified by:
getParameter
in interfaceOptimizable
-
setParameters
public void setParameters(double[] params)
- Specified by:
setParameters
in interfaceOptimizable
-
setParameter
public void setParameter(int index, double value)
- Specified by:
setParameter
in interfaceOptimizable
-
cacheValueAndGradient
public void cacheValueAndGradient()
-
setGaussianPriorVariance
public void setGaussianPriorVariance(double variance)
-
getValueGradient
public void getValueGradient(double[] buffer)
- Specified by:
getValueGradient
in interfaceOptimizable.ByGradientValue
-
getValue
public double getValue()
- Specified by:
getValue
in interfaceOptimizable.ByGradientValue
-
shutdown
public void shutdown()
Should be called after training is complete to shutdown all threads.
-
-