hhreco.classification
Class TrainingSet

java.lang.Object
  extended byhhreco.classification.TrainingSet

public final class TrainingSet
extends java.lang.Object

A TrainingSet contains a set of types, and for each type a corresponding set of positive and negative examples. It used to train a TrainableClassifier.


Constructor Summary
TrainingSet()
          Construct an empty training set.
 
Method Summary
 void addExample(java.lang.String t, FeatureSet s, int which)
          Add a example to this training set for the given type (either positive or negative, denoted by the "which" argument).
 void addNegativeExample(java.lang.String t, FeatureSet s)
          Add a negative example to this training set for the given type.
 void addPositiveExample(java.lang.String t, FeatureSet s)
          Add a positive example to this training set for the given type.
 boolean containsType(java.lang.String t)
          Return true if the training type with the specified name is in the set, or false otherwise.
 int getTypeCount()
          Return how many types are contained in this training set.
 int negativeExampleCount(java.lang.String t)
          Return the number of negative examples for the given type.
 java.util.Iterator negativeExamples(java.lang.String t)
          An iterator over the negative examples for the given type.
 int positiveExampleCount(java.lang.String t)
          Return the number of positive examples for the given type.
 java.util.Iterator positiveExamples(java.lang.String t)
          An iterator over the positive examples for the given type.
 void removeType(java.lang.String t)
          Remove the specified type from this training set.
 java.lang.String toString()
           
 java.util.Iterator types()
          An iterator over the types contained in this training set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TrainingSet

public TrainingSet()
Construct an empty training set.

Method Detail

addNegativeExample

public final void addNegativeExample(java.lang.String t,
                                     FeatureSet s)
Add a negative example to this training set for the given type.


addPositiveExample

public final void addPositiveExample(java.lang.String t,
                                     FeatureSet s)
Add a positive example to this training set for the given type.


addExample

public final void addExample(java.lang.String t,
                             FeatureSet s,
                             int which)
Add a example to this training set for the given type (either positive or negative, denoted by the "which" argument).


containsType

public final boolean containsType(java.lang.String t)
Return true if the training type with the specified name is in the set, or false otherwise.


getTypeCount

public final int getTypeCount()
Return how many types are contained in this training set.


negativeExampleCount

public final int negativeExampleCount(java.lang.String t)
Return the number of negative examples for the given type.


negativeExamples

public final java.util.Iterator negativeExamples(java.lang.String t)
An iterator over the negative examples for the given type.


positiveExampleCount

public final int positiveExampleCount(java.lang.String t)
Return the number of positive examples for the given type.


positiveExamples

public final java.util.Iterator positiveExamples(java.lang.String t)
An iterator over the positive examples for the given type.


removeType

public final void removeType(java.lang.String t)
Remove the specified type from this training set. This method cannot be called while iterating over the types, otherwise a ConcurrentModificationException will be thrown.


types

public java.util.Iterator types()
An iterator over the types contained in this training set.


toString

public java.lang.String toString()