edu.cmu.minorthird.classify
Class MutableInstance

java.lang.Object
  extended by edu.cmu.minorthird.classify.AbstractInstance
      extended by edu.cmu.minorthird.classify.MutableInstance
All Implemented Interfaces:
HasSubpopulationId, Instance, Visible

public class MutableInstance
extends AbstractInstance

A single instance for a learner.

Author:
William Cohen

Field Summary
 
Fields inherited from class edu.cmu.minorthird.classify.AbstractInstance
source, subpopulationId
 
Constructor Summary
MutableInstance()
           
MutableInstance(java.lang.Object source)
           
MutableInstance(java.lang.Object source, java.lang.String subpopulationId)
           
 
Method Summary
 void addBinary(Feature feature)
          Add a binary feature.
 void addNumeric(Feature feature, double value)
          Add a numeric feature.
 java.util.Iterator<Feature> binaryFeatureIterator()
          Return an iterator over all binary features
 java.util.Iterator<Feature> featureIterator()
          Return an iterator over all features
 double getWeight(Feature feature)
          Get the weight assigned to a feature in this instance.
static void main(java.lang.String[] args)
           
 java.util.Iterator<Feature> numericFeatureIterator()
          Return an iterator over all numeric features
 int numFeatures()
          Return the number of all the features
 
Methods inherited from class edu.cmu.minorthird.classify.AbstractInstance
getSource, getSubpopulationId, toGUI, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MutableInstance

public MutableInstance(java.lang.Object source,
                       java.lang.String subpopulationId)

MutableInstance

public MutableInstance(java.lang.Object source)

MutableInstance

public MutableInstance()
Method Detail

addNumeric

public void addNumeric(Feature feature,
                       double value)
Add a numeric feature. This also deletes the binary version of feature, if it exists.


addBinary

public void addBinary(Feature feature)
Add a binary feature.


getWeight

public double getWeight(Feature feature)
Get the weight assigned to a feature in this instance.


binaryFeatureIterator

public java.util.Iterator<Feature> binaryFeatureIterator()
Return an iterator over all binary features


numericFeatureIterator

public java.util.Iterator<Feature> numericFeatureIterator()
Return an iterator over all numeric features


featureIterator

public java.util.Iterator<Feature> featureIterator()
Return an iterator over all features


numFeatures

public int numFeatures()
Description copied from interface: Instance
Return the number of all the features


main

public static void main(java.lang.String[] args)