Class DecisionTree

java.lang.Object
  extended by Classifier
      extended by DecisionTree

public class DecisionTree
extends Classifier

Implements a simple decision tree classifier with no pruning.

Author:
jmac

Field Summary
 
Fields inherited from class Classifier
missingData, unknownClass
 
Constructor Summary
DecisionTree(AttributeSet attributeSet)
           
 
Method Summary
 java.util.Hashtable<java.lang.String,java.lang.Double> computeClassProbabilities(Instance instance)
           
 java.lang.String decide(Instance instance)
           
 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

DecisionTree

public DecisionTree(AttributeSet attributeSet)
Parameters:
attributeSet - the set of attributes to be used by this classifier
Method Detail

computeClassProbabilities

public java.util.Hashtable<java.lang.String,java.lang.Double> computeClassProbabilities(Instance instance)
                                                                                 throws java.lang.Exception
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
Throws:
java.lang.Exception

decide

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

learn

public void learn(InstanceSet trainingSet)
           throws java.lang.Exception
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
Throws:
java.lang.Exception

print

public void print()
           throws java.lang.Exception
Description copied from class: Classifier
print out a legible form of the classifier

Specified by:
print in class Classifier
Throws:
java.lang.Exception