calhoun.analysis.crf.solver
Class SemiMarkovViterbi
java.lang.Object
calhoun.analysis.crf.solver.SemiMarkovViterbi
- All Implemented Interfaces:
- CRFInference
public class SemiMarkovViterbi
- extends java.lang.Object
- implements CRFInference
viterbi algorithm for semi-Markov CRFs. Uses a CacheProcessor to handle the complexities of evaluation.
This is similar to a markov viterbi search, except we have to search over all valid segments to fill in one entry
in the matrix instead of just looking at the last position.
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SemiMarkovViterbi
public SemiMarkovViterbi()
getCacheProcessor
public CacheProcessor getCacheProcessor()
- gets the cache processor used to access feature evaluations
- Returns:
- the configured cache processor
setCacheProcessor
public void setCacheProcessor(CacheProcessor cacheProcessor)
- sets the cache processor used to access feature evaluations
- Parameters:
cacheProcessor - the cache processor to use
predict
public CRFInference.InferenceResult predict(ModelManager fm,
InputSequence<?> seq,
double[] lambda)
- Description copied from interface:
CRFInference
- Return the labelling that maximizes the conditional probability P(y|x).
- Specified by:
predict in interface CRFInference
- Parameters:
fm - model to use for trainingseq - input sequence to labellambda - array of feature weights. Usually these will be derived from a training pass.
- Returns:
- inference result containing the hidden states which are predicted and the score outputs.