dice.tree.structure
Class Leaf

java.lang.Object
  extended by dice.tree.structure.Leaf
All Implemented Interfaces:
Node, java.io.Serializable

public class Leaf
extends java.lang.Object
implements Node

Leaf node of the a decision tree.

Author:
Zhang Xiatian
See Also:
Serialized Form

Field Summary
 double[] dist
          The array of the distribution of the classes.
 int[] distIndex
          The index array of the distribution of the classes.
private static long serialVersionUID
           
 int size
          The number of the training instances.
 double v
          The average number of the responding variable.
 
Fields inherited from interface dice.tree.structure.Node
frac
 
Constructor Summary
Leaf()
           
 
Method Summary
 void addDist(int c)
          Add a new appearance class into the distribution arrays.
 void addDists(int classSize)
          /** Create distIndex and dist according the assigned possible number of values of the split attribute.
 void addValue(double v)
          Add a responding variable's value.
 void clear()
          Clear the node to reduce the space consumption.
 double getDist(int c)
          Get the distribution for the given class.
 double getValue()
          Get the average value of the responding variable in this leaf.
 void incDist(int c)
          Increase a count for the given class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

distIndex

public int[] distIndex
The index array of the distribution of the classes.


dist

public double[] dist
The array of the distribution of the classes.


size

public int size
The number of the training instances.


v

public double v
The average number of the responding variable. For regression.

Constructor Detail

Leaf

public Leaf()
Method Detail

clear

public void clear()
Description copied from interface: Node
Clear the node to reduce the space consumption.

Specified by:
clear in interface Node

addDists

public void addDists(int classSize)
/** Create distIndex and dist according the assigned possible number of values of the split attribute. This function not create the exactly the same number of the parameter. It will claim a small array t avoid space waste. In leaf, in some situation, the number of instances may be less than the number of the possible values of the split attributes. The array creation strategy is design to avoid that situation.

Parameters:
classSize - The possible number of values of the split attribute.

addDist

public void addDist(int c)
Add a new appearance class into the distribution arrays.

Parameters:
c - The class id.

incDist

public void incDist(int c)
Increase a count for the given class.

Parameters:
c - The

getDist

public double getDist(int c)
Get the distribution for the given class.

Parameters:
c - The class id.
Returns:

addValue

public void addValue(double v)
Add a responding variable's value. For regression.

Parameters:
v - The value of responding variable.

getValue

public double getValue()
Get the average value of the responding variable in this leaf. For regression.

Returns: