edu.cmu.minorthird.classify.algorithms.active
Class QueryByCommittee

java.lang.Object
  extended by edu.cmu.minorthird.classify.algorithms.active.QueryByCommittee
All Implemented Interfaces:
ClassifierLearner, java.lang.Cloneable

public class QueryByCommittee
extends java.lang.Object
implements ClassifierLearner

Implements the query-by-committee algorithm, using bagging to generate a committee.

Author:
William Cohen

Constructor Summary
QueryByCommittee()
           
QueryByCommittee(BatchClassifierLearner learner, int committeeSize)
           
 
Method Summary
 void addExample(Example example)
          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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryByCommittee

public QueryByCommittee()

QueryByCommittee

public QueryByCommittee(BatchClassifierLearner learner,
                        int committeeSize)
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

reset

public final void reset()
Description copied from interface: ClassifierLearner
Forget everything and prepare for a new learning session.

Specified by:
reset in interface ClassifierLearner

setSchema

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

getSchema

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

Specified by:
getSchema in interface ClassifierLearner

setInstancePool

public final void setInstancePool(java.util.Iterator<Instance> i)
Description copied from interface: ClassifierLearner
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.

Specified by:
setInstancePool in interface ClassifierLearner

hasNextQuery

public final boolean hasNextQuery()
Description copied from interface: ClassifierLearner
Returns true if the learner has more queries to answer.

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

Specified by:
hasNextQuery in interface ClassifierLearner

nextQuery

public final Instance nextQuery()
Description copied from interface: ClassifierLearner
Returns an Instance for which the learner would like a label.

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

Specified by:
nextQuery in interface ClassifierLearner

addExample

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

completeTraining

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

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