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 classCRFOptimizableByLabelLikelihood.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[]cachedGradientprotected doublecachedValueprotected CRF.Factorsconstraintsprotected CRFcrfprotected CRF.Factorsexpectationsprotected java.util.BitSetinfiniteValuesprotected InstanceListtrainingSet
-
Constructor Summary
Constructors Constructor Description CRFOptimizableByLabelLikelihood(CRF crf, InstanceList ilist)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidgatherConstraints(InstanceList ilist)protected doublegetExpectationValue()doublegetGaussianPriorVariance()intgetNumParameters()doublegetParameter(int index)voidgetParameters(double[] buffer)doublegetUseHyperbolicPriorSharpness()doublegetUseHyperbolicPriorSlope()doublegetValue()Returns the log probability of the training sequence labels and the prior over parameters.voidgetValueGradient(double[] buffer)voidsetGaussianPriorVariance(double p)voidsetHyperbolicPriorSharpness(double p)voidsetHyperbolicPriorSlope(double p)voidsetParameter(int index, double value)voidsetParameters(double[] buff)voidsetUseHyperbolicPrior(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:
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[] buff)
- Specified by:
setParametersin interfaceOptimizable
-
setParameter
public void setParameter(int index, double value)- Specified by:
setParameterin 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:
getValuein interfaceOptimizable.ByGradientValue
-
getValueGradient
public void getValueGradient(double[] buffer)
- Specified by:
getValueGradientin 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()
-
-