edu.cmu.minorthird.classify
Interface ClassifierLearner

All Superinterfaces:
java.lang.Cloneable
All Known Subinterfaces:
BinaryClassifierLearner
All Known Implementing Classes:
AdaBoost, AdaBoost.L, BalancedWinnow, BatchBinaryClassifierLearner, BatchClassifierLearner, BatchRankingLearner, BatchVersion, BBMira, BinaryBatchVersion, CascadingBinaryLearner, DecisionTreeLearner, FastRandomTreeLearner, KernelVotedPerceptron, KnnLearner, KWayMixtureLearner, ListNet, ManyVsRestLearner, MarginPerceptron, MaxEntLearner, MistakeCountingOnlineLearner, MostFrequentFirstLearner, MultiLearner, NaiveBayes, NegativeBinomialLearner, OneVsAllLearner, OnlineBinaryClassifierLearner, OnlineClassifierLearner, OnlineVersion, PassiveAggressiveLearner, PoissonLearner, QueryByCommittee, RandomForests, RandomTreeLearner, RankingBoosted, RankingPerceptron, Recommended.BoostedDecisionTreeLearner, Recommended.BoostedStumpLearner, Recommended.CascadingBinaryLearner, Recommended.DecisionTreeLearner, Recommended.KnnLearner, Recommended.MaxEntLearner, Recommended.MostFrequentFirstLearner, Recommended.NaiveBayes, Recommended.OneVsAllLearner, Recommended.SVMLearner, Recommended.TweakedLearner, Recommended.VotedPerceptronLearner, RegretWinnow, ROMMALearner, SemiSupervisedBatchClassifierLearner, SemiSupervisedNaiveBayesLearner, StackedBatchClassifierLearner, StackedGraphicalLearner, StackedLearner, SVMLearner, TransformingBatchLearner, TweakedLearner, VitorBalancedWinnow, VotedPerceptron, Winnow

public interface ClassifierLearner
extends java.lang.Cloneable

Learn an Classifier. This describes the learner's side of the protocol used to communicate between "learners" and "teachers".

Author:
William Cohen

Method Summary
 void addExample(Example answeredQuery)
          Accept a labeled example.
 void completeTraining()
          Accept a signal that no more training data is available.
 ClassifierLearner copy()
          Make a copy of the learner.
 Classifier getClassifier()
          Return the learned classifier.
 ExampleSchema getSchema()
          Returns the ExampleSchema - constraints on what the Examples will be.
 boolean hasNextQuery()
          Returns true if the learner has more queries to answer.
 Instance nextQuery()
          Returns an Instance for which the learner would like a label.
 void reset()
          Forget everything and prepare for a new learning session.
 void setInstancePool(java.util.Iterator<Instance> i)
          Accept a set of unlabeled instances.
 void setSchema(ExampleSchema schema)
          Accept an ExampleSchema - constraints on what the Examples will be.
 

Method Detail

setSchema

void setSchema(ExampleSchema schema)
Accept an ExampleSchema - constraints on what the Examples will be.


getSchema

ExampleSchema getSchema()
Returns the ExampleSchema - constraints on what the Examples will be.


reset

void reset()
Forget everything and prepare for a new learning session.


copy

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


setInstancePool

void setInstancePool(java.util.Iterator<Instance> i)
Accept a set of unlabeled instances. These might be used in formulating queries in active learning, or for semi-supervised learning. Queries are made with the methods hasNextQuery(), nextQuery(), and setAnswer().

Learners need not make use of the instance pool.


hasNextQuery

boolean hasNextQuery()
Returns true if the learner has more queries to answer.

Learners may always return 'false', if they are not active.


nextQuery

Instance nextQuery()
Returns an Instance for which the learner would like a label.

This will only be called if hasNextQuery() returns true.


addExample

void addExample(Example answeredQuery)
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.


completeTraining

void completeTraining()
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().


getClassifier

Classifier getClassifier()
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.