edu.cmu.minorthird.classify.sequential
Class CMM

java.lang.Object
  extended by edu.cmu.minorthird.classify.sequential.CMM
All Implemented Interfaces:
ConfidenceReportingSequenceClassifier, SequenceClassifier, SequenceConstants, Visible, java.io.Serializable

public class CMM
extends java.lang.Object
implements ConfidenceReportingSequenceClassifier, SequenceConstants, Visible, 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
CMM(Classifier classifier, int historySize, ExampleSchema schema)
           
 
Method Summary
 ClassLabel[] classification(Instance[] sequence)
          Return a predicted type for each element of the sequence.
 double confidence(Instance[] sequence, ClassLabel[] predictedClasses, ClassLabel[] alternateClasses, int lo, int hi)
          Return a measure of confidence that the correct ClassLabels for indices lo...hi-1 of the 'sequence' are in fact the ones in 'predictedClasses[lo..hi-1]', rather than the ones given in in 'alternateClasses'.
 java.lang.String explain(Instance[] sequence)
          Return some string that 'explains' the classification
 Classifier getClassifier()
           
 Explanation getExplanation(Instance[] sequence)
          Return and explanation for a classification
 int getHistorySize()
           
 Viewer toGUI()
          Create a view of this object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CMM

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

getClassifier

public Classifier getClassifier()

getHistorySize

public int getHistorySize()

classification

public ClassLabel[] classification(Instance[] sequence)
Description copied from interface: SequenceClassifier
Return a predicted type for each element of the sequence.

Specified by:
classification in interface SequenceClassifier

confidence

public double confidence(Instance[] sequence,
                         ClassLabel[] predictedClasses,
                         ClassLabel[] alternateClasses,
                         int lo,
                         int hi)
Description copied from interface: ConfidenceReportingSequenceClassifier
Return a measure of confidence that the correct ClassLabels for indices lo...hi-1 of the 'sequence' are in fact the ones in 'predictedClasses[lo..hi-1]', rather than the ones given in in 'alternateClasses'.

You can think of 'alternateClasses' as a sort of template, indicating constraints on the sequence of predictions that are allowed. 'Confidence' is confidence of the predictedClasses relative to the best-scoring prediction that is consistent with the 'alternateClasses' template. NULL values in the alternateClasses array indicate positions for which no alternate ClassLabels are required. In this case, the confidence returned should be (approximately) the maximum over all possible values for the slots filled with NULL values.

For instance, if all alternateClasses values outside the range lo..hi-1 are NULL, then an HMM sequenceClassifier should return the ratio running forward-backward on the predictedClasses and alternateClasses, with only the values between lo..hi-1 fixed.

Since classifications in the sequence are not independent, the values of 'alternateClasses' in positions outside of lo..hi-1 may affect this confidence.

Specified by:
confidence in interface ConfidenceReportingSequenceClassifier
Parameters:
sequence - is a sequence of instances to classify
predictedClasses - is a classification of the sequence, as given by a call to 'classify'
alternateClasses - is another possible classification of the sequence.
lo - is an index into sequence[] (or equivalently, any of the other array arguments)
hi - is another index into sequence[]
Returns:
some value that monotonic in confidence

explain

public java.lang.String explain(Instance[] sequence)
Description copied from interface: SequenceClassifier
Return some string that 'explains' the classification

Specified by:
explain in interface SequenceClassifier

getExplanation

public Explanation getExplanation(Instance[] sequence)
Description copied from interface: SequenceClassifier
Return and explanation for a classification

Specified by:
getExplanation in interface SequenceClassifier

toGUI

public Viewer toGUI()
Description copied from interface: Visible
Create a view of this object

Specified by:
toGUI in interface Visible