|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--learn.DecisionTree
The DecisionTree
class implements a decision tree.
Field Summary | |
protected Variable |
classVar
|
protected DataSet |
ds
|
protected java.util.Vector |
examples
|
protected java.lang.String |
name
|
protected java.lang.String[] |
record
|
protected static javax.swing.JTextArea |
textArea1
|
protected java.util.Hashtable |
variableList
|
Constructor Summary | |
DecisionTree(java.lang.String Name)
Creates an instance of a decision tree with the given name. |
Method Summary | |
static void |
appendText(java.lang.String text)
Appends text to the text area. |
Node |
buildDecisionTree(java.util.Vector examples,
java.util.Hashtable variables,
Node defaultValue)
Constructs a decision tree with the given a vector of example data records, splitting on variables and values with the most information content. |
(package private) Variable |
chooseVariable(java.util.Hashtable variables,
java.util.Vector examples)
Chooses the variable with the greatest gain. |
(package private) double |
computeInfo(int p,
int n)
Computes the information content, given the number of positive and negative examples. |
(package private) double |
computeRemainder(Variable variable,
java.util.Vector examples)
Computes the remainder value for the given variable and vector. |
int[] |
getCounts(java.util.Vector examples)
Returns an integer array containing the number of occurrences of each discrete value in the given vector. |
boolean |
identical(java.util.Vector examples,
Variable variable)
Determines whether each record in the examples vector
matches the given variable value. |
java.lang.String |
majority(java.util.Vector examples)
Returns the value which occurs most often in the given vector. |
(package private) java.util.Vector |
subset(java.util.Vector examples,
Variable variable,
java.lang.String value)
Returns a subset of a vector where the variable name equals the given value. |
Methods inherited from class java.lang.Object |
|
Field Detail |
protected java.lang.String name
protected DataSet ds
protected Variable classVar
protected java.util.Hashtable variableList
protected java.util.Vector examples
protected static javax.swing.JTextArea textArea1
protected java.lang.String[] record
Constructor Detail |
public DecisionTree(java.lang.String Name)
name
- the String object that contains the name of this decision treeName
- the String objectMethod Detail |
public static void appendText(java.lang.String text)
text
- the String object that contains the text to be displayedpublic boolean identical(java.util.Vector examples, Variable variable)
examples
vector
matches the given variable value.examples
- the Vector object that contains the recordsvariable
- the Variable object that contains the value to be matchedtrue
if the records
match and false
if they do notpublic java.lang.String majority(java.util.Vector examples)
examples
- the Vector object which is examinedpublic int[] getCounts(java.util.Vector examples)
examples
- the Vector object that contains the discrete valuesdouble computeInfo(int p, int n)
p
- the number of positve valuesn
- the number of negative valuesdouble computeRemainder(Variable variable, java.util.Vector examples)
variable
- the Variable object for which the remainder is computedexamples
- the Vector object that contains the recordsjava.util.Vector subset(java.util.Vector examples, Variable variable, java.lang.String value)
examples
- the Vector object that contains the recordsvariable
- the Variable objectvalue
- the String value to be matchedVariable chooseVariable(java.util.Hashtable variables, java.util.Vector examples)
variables
- the Hashtable object that contains the variablesexamples
- the Vector object that contains the recordspublic Node buildDecisionTree(java.util.Vector examples, java.util.Hashtable variables, Node defaultValue)
examples
- the Vector object that contains the example recordsvariables
- the Hashtable object that contains the variablesdefaultValue
- the Node object that contains the default value
if the tree cannot be built from the examples
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |