Class DecisionStump

java.lang.Object
  extended by Classifier
      extended by DecisionStump

public class DecisionStump
extends Classifier

The DecisionStump class implements a 1-level decision tree

Author:
John MacCormick

Field Summary
 
Fields inherited from class Classifier
missingData, unknownClass
 
Constructor Summary
DecisionStump(AttributeSet attributeSet)
           
DecisionStump(AttributeSet attributeSet, java.util.ArrayList<Attribute> availableAttributes)
           
 
Method Summary
 java.util.Hashtable<java.lang.String,java.lang.Double> computeClassProbabilities(Instance instance)
           
 java.lang.String decide(Instance instance)
           
 java.util.ArrayList<Attribute> getAvailableAttributes()
           
 Attribute getBestAttribute()
           
 int getNumErrors()
           
 void learn(InstanceSet trainingSet)
          Learn a classifier from the given training set
 void print()
          print out a legible form of the classifier
 
Methods inherited from class Classifier
computeErrorRate, getAttributeSet, main, printDecisionsAndProbabilities
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DecisionStump

public DecisionStump(AttributeSet attributeSet)
Parameters:
attributeSet - the set of attributes used by the machine learning problem which this decision stump will tackle

DecisionStump

public DecisionStump(AttributeSet attributeSet,
                     java.util.ArrayList<Attribute> availableAttributes)
Parameters:
attributeSet - the set of attributes used by the machine learning problem which this decision stump will tackle
availableAttributes - A list of attributes from which this decision stump is permitted to choose (it will choose to split the data on the attribute that results in the lowest expected entropy).
Method Detail

learn

public void learn(InstanceSet trainingSet)
Description copied from class: Classifier
Learn a classifier from the given training set

Specified by:
learn in class Classifier
Parameters:
trainingSet - the training set from which to learn the classifier

decide

public java.lang.String decide(Instance instance)
Specified by:
decide in class Classifier
Parameters:
instance - the instance whose class is to be decided
Returns:
the class value of the instance

computeClassProbabilities

public java.util.Hashtable<java.lang.String,java.lang.Double> computeClassProbabilities(Instance instance)
Specified by:
computeClassProbabilities in class Classifier
Parameters:
instance - the instance whose class probabilities are to be computed
Returns:
a table mapping class values to their probabilities

print

public void print()
Description copied from class: Classifier
print out a legible form of the classifier

Specified by:
print in class Classifier

getAvailableAttributes

public java.util.ArrayList<Attribute> getAvailableAttributes()
Returns:
the list of attributes from which this decision stump is permitted to choose (it will choose to split the data on the attribute that results in the lowest expected entropy)

getBestAttribute

public Attribute getBestAttribute()
Returns:
the bestAttribute

getNumErrors

public int getNumErrors()