cc.mallet.fst
Class CRFOptimizableByLabelLikelihood

java.lang.Object
  extended by 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
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
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
CRFOptimizableByLabelLikelihood(CRF crf, InstanceList ilist)
           
 
Method Summary
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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 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[] buff)
Specified by:
setParameters in interface Optimizable

setParameter

public void setParameter(int index,
                         double value)
Specified by:
setParameter in interface Optimizable

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 interface Optimizable.ByGradientValue

getValueGradient

public void getValueGradient(double[] buffer)
Specified by:
getValueGradient in interface Optimizable.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()