edu.cmu.minorthird.classify
Class OnlineVersion

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

public class OnlineVersion
extends OnlineClassifierLearner

Online version of a BatchClassifierLearner.

Author:
William Cohen

Constructor Summary
OnlineVersion()
           
OnlineVersion(BatchClassifierLearner innerLearner)
           
OnlineVersion(BatchClassifierLearner innerLearner, double loadFactor)
           
OnlineVersion(BatchClassifierLearner innerLearner, double loadFactor, OnlineClassifierLearner bootstrapLearner, int minBatchTrainingSize)
          Emulate on-line learning with a batch algorithm.
 
Method Summary
 void addExample(Example example)
          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.
 double getBatchLoadFactor()
           
 OnlineClassifierLearner getBootstrapLearner()
           
 Classifier getClassifier()
          Subclasses should use this method to return the current classifier.
 BatchClassifierLearner getInnerLearner()
           
 int getMinBatchTrainingSize()
           
 ExampleSchema getSchema()
          Returns the ExampleSchema - constraints on what the Examples will be.
 void reset()
          'forget' everything about the last learning task, and start a new task.
 void setBatchLoadFactor(double d)
           
 void setBootstrapLearner(OnlineClassifierLearner learner)
           
 void setInnerLearner(BatchClassifierLearner learner)
           
 void setMinBatchTrainingSize(int m)
           
 void setSchema(ExampleSchema schema)
          Accept an ExampleSchema - constraints on what the Examples will be.
 
Methods inherited from class edu.cmu.minorthird.classify.OnlineClassifierLearner
copy, hasNextQuery, nextQuery, setInstancePool
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OnlineVersion

public OnlineVersion(BatchClassifierLearner innerLearner,
                     double loadFactor,
                     OnlineClassifierLearner bootstrapLearner,
                     int minBatchTrainingSize)
Emulate on-line learning with a batch algorithm.

Parameters:
innerLearner - batch learning algorithm
loadFactor - re-train batch algorithm when number of available examples is loadFactor * M, where M is the number of examples available at the last training round.
bootstrapLearner - on-line learner used for the first few rounds
minBatchTrainingSize - use online bootstrapLearner until minBatchTrainingSize examples are available.

OnlineVersion

public OnlineVersion(BatchClassifierLearner innerLearner,
                     double loadFactor)

OnlineVersion

public OnlineVersion(BatchClassifierLearner innerLearner)

OnlineVersion

public OnlineVersion()
Method Detail

getInnerLearner

public BatchClassifierLearner getInnerLearner()

setInnerLearner

public void setInnerLearner(BatchClassifierLearner learner)

getBootstrapLearner

public OnlineClassifierLearner getBootstrapLearner()

setBootstrapLearner

public void setBootstrapLearner(OnlineClassifierLearner learner)

getBatchLoadFactor

public double getBatchLoadFactor()

setBatchLoadFactor

public void setBatchLoadFactor(double d)

getMinBatchTrainingSize

public int getMinBatchTrainingSize()

setMinBatchTrainingSize

public void setMinBatchTrainingSize(int m)

setSchema

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


getSchema

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


reset

public final 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

addExample

public final void addExample(Example example)
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

completeTraining

public final 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

getClassifier

public final 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