edu.cmu.minorthird.classify
Class CascadingBinaryLearner

java.lang.Object
  extended by edu.cmu.minorthird.classify.OneVsAllLearner
      extended by edu.cmu.minorthird.classify.CascadingBinaryLearner
All Implemented Interfaces:
ClassifierLearner, java.lang.Cloneable
Direct Known Subclasses:
Recommended.CascadingBinaryLearner

public class CascadingBinaryLearner
extends OneVsAllLearner

Multi-class version of a binary classifier. Puts classifiers in order of ones with the most positive examples first.

Author:
Cameron Williams

Nested Class Summary
 
Nested classes/interfaces inherited from class edu.cmu.minorthird.classify.OneVsAllLearner
OneVsAllLearner.IllegalArgumentException
 
Field Summary
 java.lang.String[] sortedClassNames
           
 
Fields inherited from class edu.cmu.minorthird.classify.OneVsAllLearner
innerLearner, learner, learnerFactory, learnerName, schema
 
Constructor Summary
CascadingBinaryLearner()
           
CascadingBinaryLearner(BatchClassifierLearner learner)
           
CascadingBinaryLearner(ClassifierLearnerFactory learnerFactory)
          Deprecated. use CascadingBinaryLearner(BatchClassifierLearner learner)
CascadingBinaryLearner(java.lang.String l)
           
 
Method Summary
 void addExample(Example answeredQuery)
          Accept a labeled example.
 void completeTraining()
          Accept a signal that no more training data is available.
 Classifier getClassifier()
          Return the learned classifier.
 void setSchema(ExampleSchema schema)
          Accept an ExampleSchema - constraints on what the Examples will be.
 
Methods inherited from class edu.cmu.minorthird.classify.OneVsAllLearner
copy, getInnerLearner, getSchema, hasNextQuery, nextQuery, reset, setInnerLearner, setInstancePool
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sortedClassNames

public java.lang.String[] sortedClassNames
Constructor Detail

CascadingBinaryLearner

public CascadingBinaryLearner()

CascadingBinaryLearner

public CascadingBinaryLearner(ClassifierLearnerFactory learnerFactory)
Deprecated. use CascadingBinaryLearner(BatchClassifierLearner learner)

Parameters:
learnerFactory - a ClassifierLearnerFactory which should produce a BinaryClassifier with each call.

CascadingBinaryLearner

public CascadingBinaryLearner(java.lang.String l)

CascadingBinaryLearner

public CascadingBinaryLearner(BatchClassifierLearner learner)
Method Detail

setSchema

public void setSchema(ExampleSchema schema)
Description copied from interface: ClassifierLearner
Accept an ExampleSchema - constraints on what the Examples will be.

Specified by:
setSchema in interface ClassifierLearner
Overrides:
setSchema in class OneVsAllLearner

addExample

public void addExample(Example answeredQuery)
Description copied from interface: ClassifierLearner
Accept a labeled example. The example might be the answer to the last query, or it may be an example chosen by the teacher.

All learners must provide a non-trivial implementation of addExample.

Specified by:
addExample in interface ClassifierLearner
Overrides:
addExample in class OneVsAllLearner

completeTraining

public void completeTraining()
Description copied from interface: ClassifierLearner
Accept a signal that no more training data is available. This would trigger any additional computation that might be useful to speed up or improve the results of getClassifier().

Specified by:
completeTraining in interface ClassifierLearner
Overrides:
completeTraining in class OneVsAllLearner

getClassifier

public Classifier getClassifier()
Description copied from interface: ClassifierLearner
Return the learned classifier. The classifier should take advantage of all information sent by the teacher to date. Teachers can assume that multiple calls to getClassifier() without intervening calls to addExample() will return the same object, and do little computation. Teachers can not assume that this object is immutable: for instance, in the case of an on-line learning method, the classifier that is returned might change after more examples are learned.

All learners must implement this method.

Specified by:
getClassifier in interface ClassifierLearner
Overrides:
getClassifier in class OneVsAllLearner