com.huguesjohnson.jail.jdt
Class DecisionTree

java.lang.Object
  |
  +--com.huguesjohnson.jail.jdt.DecisionTree
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class DecisionTree
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

JdtDecisionTree

See Also:
Serialized Form

Constructor Summary
DecisionTree(java.util.Vector attributes, java.util.Vector trainingData, java.lang.String[] classifications)
          constructor
 
Method Summary
 java.lang.String breadthFirstSearch()
          returns a string representing a breadth first search of the tree
 java.util.Vector breadthFirstSearchVector()
          returns a vector representing a breadth first search of the tree
 java.lang.String classify(DataInstance dataInstance)
          tries to classify a dataInstance
 java.lang.Object clone()
          clone
 void prune(java.util.Vector pruneData)
          prunes the tree based on a vector of pruning data
 double testAccuracy(java.util.Vector testData)
          tests the accuracy of the tree
 java.lang.String toString()
          returns a string representation of the tree
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DecisionTree

public DecisionTree(java.util.Vector attributes,
                    java.util.Vector trainingData,
                    java.lang.String[] classifications)
constructor
Parameters:
attributes - vector of all attributes for data
trainingData - vector of data used to train the tree
classifications - names of all valid classifications
Method Detail

clone

public java.lang.Object clone()
clone
Overrides:
clone in class java.lang.Object
Returns:
clone of object

classify

public java.lang.String classify(DataInstance dataInstance)
tries to classify a dataInstance
Parameters:
dataInstance - the dataInstance to try and classify
Returns:
classification for dataInstance

prune

public void prune(java.util.Vector pruneData)
prunes the tree based on a vector of pruning data
Parameters:
pruneData - data used to prune tree

testAccuracy

public double testAccuracy(java.util.Vector testData)
tests the accuracy of the tree
Parameters:
testData - data to use in test
Returns:
accuracy of tree

breadthFirstSearch

public java.lang.String breadthFirstSearch()
returns a string representing a breadth first search of the tree
Returns:
breadth first search of tree

breadthFirstSearchVector

public java.util.Vector breadthFirstSearchVector()
returns a vector representing a breadth first search of the tree
Returns:
breadth first search of tree

toString

public java.lang.String toString()
returns a string representation of the tree
Overrides:
toString in class java.lang.Object
Returns:
representation of the tree