calhoun.analysis.crf.solver
Class SemiMarkovViterbi

java.lang.Object
  extended by 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.


Nested Class Summary
 
Nested classes/interfaces inherited from interface calhoun.analysis.crf.CRFInference
CRFInference.InferenceResult
 
Constructor Summary
SemiMarkovViterbi()
           
 
Method Summary
 CacheProcessor getCacheProcessor()
          gets the cache processor used to access feature evaluations
 CRFInference.InferenceResult predict(ModelManager fm, InputSequence<?> seq, double[] lambda)
          Return the labelling that maximizes the conditional probability P(y|x).
 void setCacheProcessor(CacheProcessor cacheProcessor)
          sets the cache processor used to access feature evaluations
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SemiMarkovViterbi

public SemiMarkovViterbi()
Method Detail

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 training
seq - input sequence to label
lambda - 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.