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
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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)
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.