calhoun.analysis.crf.solver
Class SemiMarkovViterbiNoCache

java.lang.Object
  extended by calhoun.analysis.crf.solver.SemiMarkovViterbiNoCache
All Implemented Interfaces:
CRFInference

public class SemiMarkovViterbiNoCache
extends java.lang.Object
implements CRFInference

viterbi algorithm for semi-Markov CRFs. Does not perform any caching, and does not correctly handle NodeBoundary features. Use only if you have no NodeBoundary features and are running into memory limitations. Requires that a SemiMarkovSetup be configured.


Nested Class Summary
 
Nested classes/interfaces inherited from interface calhoun.analysis.crf.CRFInference
CRFInference.InferenceResult
 
Constructor Summary
SemiMarkovViterbiNoCache()
           
 
Method Summary
 boolean isAllPaths()
          true if all paths (valid and invalid) are to be evaluated during the viterbi search.
 CRFInference.InferenceResult predict(ModelManager fm, InputSequence<?> seq, double[] lambda)
          Return the labelling that maximizes the conditional probability P(y|x).
 void setAllPaths(boolean allPaths)
          sets whether all paths (valid and invalid) are to be evaluated during the viterbi search.
 void setSemiMarkovSetup(SemiMarkovSetup setup)
          sets up the semiMarkov parameters, such as maximum segment lengths.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SemiMarkovViterbiNoCache

public SemiMarkovViterbiNoCache()
Method Detail

isAllPaths

public boolean isAllPaths()
true if all paths (valid and invalid) are to be evaluated during the viterbi search. Defaults to false.

Returns:
true if all paths are to be examined

setAllPaths

public void setAllPaths(boolean allPaths)
sets whether all paths (valid and invalid) are to be evaluated during the viterbi search. Defaults to false.

Parameters:
allPaths - allPath true if all paths are to be examined

setSemiMarkovSetup

public void setSemiMarkovSetup(SemiMarkovSetup setup)
sets up the semiMarkov parameters, such as maximum segment lengths. These should be the same as the model was trained with.

Parameters:
setup - the parameters to use during the semi-Markov viterbi search

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.