edu.cmu.minorthird.classify.sequential
Class BeamSearcher

java.lang.Object
  extended by edu.cmu.minorthird.classify.sequential.BeamSearcher
All Implemented Interfaces:
SequenceConstants, java.io.Serializable

public class BeamSearcher
extends java.lang.Object
implements SequenceConstants, java.io.Serializable

A conditional markov model classifier.

Author:
William Cohen
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface edu.cmu.minorthird.classify.sequential.SequenceConstants
HISTORY_FEATURE, NULL_CLASS_NAME
 
Constructor Summary
BeamSearcher(Classifier classifier, int historySize, ExampleSchema schema)
           
 
Method Summary
 ClassLabel[] bestLabelSequence(Instance[] instances)
          Get the best label sequence, as determined by the beam search
 void doSearch(Instance[] sequence)
          Do a beam search.
 void doSearch(Instance[] sequence, ClassLabel[] template)
          Do a beam search, constraining the bestLabel for each classification to match the non-null values in the template.
 java.lang.String explain(Instance[] sequence)
           
static Instance getBeamInstance(Instance instance, int historySize)
           
 Explanation getExplanation(Instance[] sequence)
           
 int getMaxBeamSize()
           
 int getNumberOfSolutionsFound()
          Return the number of solutions found in the beam.
 float score(int k)
           
 void setMaxBeamSize(int n)
           
 ClassLabel[] viterbi(int k)
          Retrieve the k-th best result of the previous beam search.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeamSearcher

public BeamSearcher(Classifier classifier,
                    int historySize,
                    ExampleSchema schema)
Method Detail

getMaxBeamSize

public int getMaxBeamSize()

setMaxBeamSize

public void setMaxBeamSize(int n)

bestLabelSequence

public ClassLabel[] bestLabelSequence(Instance[] instances)
Get the best label sequence, as determined by the beam search


getBeamInstance

public static Instance getBeamInstance(Instance instance,
                                       int historySize)

doSearch

public void doSearch(Instance[] sequence)
Do a beam search.


doSearch

public void doSearch(Instance[] sequence,
                     ClassLabel[] template)
Do a beam search, constraining the bestLabel for each classification to match the non-null values in the template.

This would be better folded in with the one-arg version of doSearch, but is kept separate for backward compatibility.


getNumberOfSolutionsFound

public int getNumberOfSolutionsFound()
Return the number of solutions found in the beam.


viterbi

public ClassLabel[] viterbi(int k)
Retrieve the k-th best result of the previous beam search. To get the best, use viterbi(0), the second best is viterbi(1), etc.


score

public float score(int k)

explain

public java.lang.String explain(Instance[] sequence)

getExplanation

public Explanation getExplanation(Instance[] sequence)