|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface CRFObjectiveFunctionGradient
an interface to algorithms that compute an objective function and its gradient for CRFs. The objective function is used
to determine the optimal weights during the CRF training process. Usually the objective function value and gradient
will be computed many times for different values of feature weights during a training. A numerical optimizer which implements
the CRFTraining interface is responsible for choosing the weights and calling this class.
Different implementations are avialable to handle the Markov and semi-Markov CRFs and to handle different speed/memory tradeoffs.
| Method Summary | |
|---|---|
double |
apply(double[] weights,
double[] grad)
computes the objective function value and the gradient. |
void |
clean()
Frees resources allocated by setTrainingData |
void |
setTrainingData(ModelManager fm,
java.util.List<? extends TrainingSequence<?>> data)
sets the training data that will be used for evaluation of the objective function. |
| Method Detail |
|---|
void setTrainingData(ModelManager fm,
java.util.List<? extends TrainingSequence<?>> data)
apply
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.
fm - the model to use. Defines the hidden states, transitions, and features.data - the training sequences on which to calculate the objective function.
double apply(double[] weights,
double[] grad)
weights - 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.
void clean()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||