edu.cmu.minorthird.classify.multi
Class MultiLearner

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

public class MultiLearner
extends java.lang.Object
implements ClassifierLearner

ClassifierLearner for learning multiple dimensions

Author:
Cameron Williams

Field Summary
protected  java.util.List<ClassifierLearner> innerLearner
           
protected  ClassifierLearner learner
           
protected  ClassifierLearnerFactory learnerFactory
           
protected  java.lang.String learnerName
           
protected  MultiExampleSchema multiSchema
           
 
Constructor Summary
MultiLearner()
           
MultiLearner(ClassifierLearner learner)
           
 
Method Summary
 void addExample(Example answeredQuery)
          Accept a labeled example.
 void addMultiExample(MultiExample answeredQuery)
           
 void completeTraining()
          Accept a signal that no more training data is available.
 ClassifierLearner copy()
          Make a copy of the learner.
 Classifier getClassifier()
          Returns the classifier for the first dimension
 MultiClassifier getMultiClassifier()
           
 MultiExampleSchema getMultiSchema()
           
 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> it)
          Accept a set of unlabeled instances.
 void setMultiSchema(MultiExampleSchema schema)
           
 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
 

Field Detail

learnerFactory

protected ClassifierLearnerFactory learnerFactory

learner

protected ClassifierLearner learner

learnerName

protected java.lang.String learnerName

innerLearner

protected java.util.List<ClassifierLearner> innerLearner

multiSchema

protected MultiExampleSchema multiSchema
Constructor Detail

MultiLearner

public MultiLearner(ClassifierLearner learner)

MultiLearner

public MultiLearner()
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

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

getSchema

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

Specified by:
getSchema in interface ClassifierLearner

setMultiSchema

public void setMultiSchema(MultiExampleSchema schema)

getMultiSchema

public MultiExampleSchema getMultiSchema()

reset

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

Specified by:
reset in interface ClassifierLearner

setInstancePool

public void setInstancePool(java.util.Iterator<Instance> it)
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 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 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 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

addMultiExample

public void addMultiExample(MultiExample answeredQuery)

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

getClassifier

public Classifier getClassifier()
Returns the classifier for the first dimension

Specified by:
getClassifier in interface ClassifierLearner

getMultiClassifier

public MultiClassifier getMultiClassifier()