edu.cmu.minorthird.classify
Class MistakeCountingOnlineLearner

java.lang.Object
  extended by edu.cmu.minorthird.classify.OnlineClassifierLearner
      extended by edu.cmu.minorthird.classify.MistakeCountingOnlineLearner
All Implemented Interfaces:
ClassifierLearner, java.lang.Cloneable

public class MistakeCountingOnlineLearner
extends OnlineClassifierLearner

A wrapper around on OnlineClassifierLearner that counts the number of mistakes if makes.

Author:
William Cohen

Constructor Summary
MistakeCountingOnlineLearner()
           
MistakeCountingOnlineLearner(OnlineClassifierLearner innerLearner)
           
MistakeCountingOnlineLearner(OnlineClassifierLearner innerLearner, boolean reportMistakes)
           
 
Method Summary
 void addExample(Example answeredQuery)
          Subclasses should use this method to perform whatever incremental update is needed after in response to a new example.
 void completeTraining()
          A promise from the caller that no further examples will be added.
 ClassifierLearner copy()
          Make a copy of the learner.
 Classifier getClassifier()
          Subclasses should use this method to return the current classifier.
 int getNumberOfMistakes()
          Report the number of mistakes made by the inner learner.
 ExampleSchema getSchema()
          Returns the ExampleSchema - constraints on what the Examples will be.
 int getTotalNumberOfExamples()
          Report the number of examples sent to the inner learner.
 void reset()
          'forget' everything about the last learning task, and start a new task.
 void setSchema(ExampleSchema schema)
          Accept an ExampleSchema - constraints on what the Examples will be.
 java.lang.String toString()
           
 
Methods inherited from class edu.cmu.minorthird.classify.OnlineClassifierLearner
hasNextQuery, nextQuery, setInstancePool
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MistakeCountingOnlineLearner

public MistakeCountingOnlineLearner()

MistakeCountingOnlineLearner

public MistakeCountingOnlineLearner(OnlineClassifierLearner innerLearner)

MistakeCountingOnlineLearner

public MistakeCountingOnlineLearner(OnlineClassifierLearner innerLearner,
                                    boolean reportMistakes)
Method Detail

copy

public ClassifierLearner copy()
Description copied from interface: ClassifierLearner
Make a copy of the learner. Note: This will reset the learner, erasing previous data!

Specified by:
copy in interface ClassifierLearner
Overrides:
copy in class OnlineClassifierLearner

completeTraining

public void completeTraining()
Description copied from class: OnlineClassifierLearner
A promise from the caller that no further examples will be added. Override this method if it's appropriate.

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

addExample

public void addExample(Example answeredQuery)
Description copied from class: OnlineClassifierLearner
Subclasses should use this method to perform whatever incremental update is needed after in response to a new example.

Specified by:
addExample in interface ClassifierLearner
Specified by:
addExample in class OnlineClassifierLearner

getClassifier

public Classifier getClassifier()
Description copied from class: OnlineClassifierLearner
Subclasses should use this method to return the current classifier.

Specified by:
getClassifier in interface ClassifierLearner
Specified by:
getClassifier in class OnlineClassifierLearner

setSchema

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


getSchema

public ExampleSchema getSchema()
Description copied from interface: ClassifierLearner
Returns the ExampleSchema - constraints on what the Examples will be.


reset

public void reset()
Description copied from class: OnlineClassifierLearner
'forget' everything about the last learning task, and start a new task. Subclasses need to implement this method

Specified by:
reset in interface ClassifierLearner
Specified by:
reset in class OnlineClassifierLearner

getNumberOfMistakes

public int getNumberOfMistakes()
Report the number of mistakes made by the inner learner.


getTotalNumberOfExamples

public int getTotalNumberOfExamples()
Report the number of examples sent to the inner learner.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object