Package cc.mallet.fst
Class CRFOptimizableByLabelLikelihood
- java.lang.Object
-
- cc.mallet.fst.CRFOptimizableByLabelLikelihood
-
- All Implemented Interfaces:
Optimizable
,Optimizable.ByGradientValue
,java.io.Serializable
- Direct Known Subclasses:
MEMMTrainer.MEMMOptimizableByLabelLikelihood
public class CRFOptimizableByLabelLikelihood extends java.lang.Object implements Optimizable.ByGradientValue, java.io.Serializable
An objective function for CRFs that is the label likelihood plus a Gaussian or hyperbolic prior on parameters.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CRFOptimizableByLabelLikelihood.Factory
-
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
-
-
Field Summary
Fields Modifier and Type Field Description protected double[]
cachedGradient
protected double
cachedValue
protected CRF.Factors
constraints
protected CRF
crf
protected CRF.Factors
expectations
protected java.util.BitSet
infiniteValues
protected InstanceList
trainingSet
-
Constructor Summary
Constructors Constructor Description CRFOptimizableByLabelLikelihood(CRF crf, InstanceList ilist)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
gatherConstraints(InstanceList ilist)
protected double
getExpectationValue()
double
getGaussianPriorVariance()
int
getNumParameters()
double
getParameter(int index)
void
getParameters(double[] buffer)
double
getUseHyperbolicPriorSharpness()
double
getUseHyperbolicPriorSlope()
double
getValue()
Returns the log probability of the training sequence labels and the prior over parameters.void
getValueGradient(double[] buffer)
void
setGaussianPriorVariance(double p)
void
setHyperbolicPriorSharpness(double p)
void
setHyperbolicPriorSlope(double p)
void
setParameter(int index, double value)
void
setParameters(double[] buff)
void
setUseHyperbolicPrior(boolean f)
-
-
-
Field Detail
-
trainingSet
protected InstanceList trainingSet
-
cachedValue
protected double cachedValue
-
cachedGradient
protected double[] cachedGradient
-
infiniteValues
protected java.util.BitSet infiniteValues
-
crf
protected CRF crf
-
constraints
protected CRF.Factors constraints
-
expectations
protected CRF.Factors expectations
-
-
Constructor Detail
-
CRFOptimizableByLabelLikelihood
public CRFOptimizableByLabelLikelihood(CRF crf, InstanceList ilist)
-
-
Method Detail
-
gatherConstraints
protected void gatherConstraints(InstanceList ilist)
-
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[] buff)
- Specified by:
setParameters
in interfaceOptimizable
-
setParameter
public void setParameter(int index, double value)
- Specified by:
setParameter
in interfaceOptimizable
-
getExpectationValue
protected double getExpectationValue()
-
getValue
public double getValue()
Returns the log probability of the training sequence labels and the prior over parameters.- Specified by:
getValue
in interfaceOptimizable.ByGradientValue
-
getValueGradient
public void getValueGradient(double[] buffer)
- Specified by:
getValueGradient
in interfaceOptimizable.ByGradientValue
-
setUseHyperbolicPrior
public void setUseHyperbolicPrior(boolean f)
-
setHyperbolicPriorSlope
public void setHyperbolicPriorSlope(double p)
-
setHyperbolicPriorSharpness
public void setHyperbolicPriorSharpness(double p)
-
getUseHyperbolicPriorSlope
public double getUseHyperbolicPriorSlope()
-
getUseHyperbolicPriorSharpness
public double getUseHyperbolicPriorSharpness()
-
setGaussianPriorVariance
public void setGaussianPriorVariance(double p)
-
getGaussianPriorVariance
public double getGaussianPriorVariance()
-
-