|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcalhoun.analysis.crf.solver.MaximumLikelihoodGradient
public class MaximumLikelihoodGradient
computes the likelihood of the true path for a Markov CRF. The likelihood is normalized to a per label likelihood so
that likelihood of different length paths can be meaningfully compared and a single set of optimization tolerances can be used.
Must be configured with a CacheProcessor.
| Constructor Summary | |
|---|---|
MaximumLikelihoodGradient()
|
|
| Method Summary | |
|---|---|
double |
apply(double[] param,
double[] grad)
computes the objective function value and the gradient. |
void |
clean()
Frees resources allocated by setTrainingData |
CacheProcessor |
getCacheProcessor()
gets the cache processor used to access feature evaluations |
double[] |
getFeatureSums()
|
void |
setCacheProcessor(CacheProcessor cacheProcessor)
sets the cache processor used to access feature evaluations |
void |
setTrainingData(ModelManager fm,
java.util.List<? extends TrainingSequence<?>> data)
sets the training data that will be used for evaluation of the objective function. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MaximumLikelihoodGradient()
| Method Detail |
|---|
public CacheProcessor getCacheProcessor()
public void setCacheProcessor(CacheProcessor cacheProcessor)
cacheProcessor - the cache processor to use
public void setTrainingData(ModelManager fm,
java.util.List<? extends TrainingSequence<?>> data)
CRFObjectiveFunctionGradientapply
is called to set up the training data. Since it is expected that apply will be called many times, this funtion is
the place to do one time setup and caching.
setTrainingData in interface CRFObjectiveFunctionGradientfm - the model to use. Defines the hidden states, transitions, and features.data - the training sequences on which to calculate the objective function.
public double apply(double[] param,
double[] grad)
CRFObjectiveFunctionGradient
apply in interface CRFObjectiveFunctionGradientparam - an array of feature weights to use. The length will equal the number of features in the model, and the values will change
for each call to apply.grad - an array which must be filled with the gradient vector when the function returns. For each feature index, the array should contain an
entry with the partial derivative with respect to that feature.
public void clean()
CRFObjectiveFunctionGradient
clean in interface CRFObjectiveFunctionGradientpublic double[] getFeatureSums()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||