dice.tree.structure
Class InnerNode

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

public class InnerNode
extends java.lang.Object
implements Node

Inner node of a tree.

Author:
Zhang Xiatian
See Also:
Serialized Form

Field Summary
 int attr
          Split attribute id.
 Node[] children
          The array holds the children node of the node.
 int[] childrenIndex
          The index array of the children nodes.
private static long serialVersionUID
           
 double split
          Split value of the split attribute.
 
Fields inherited from interface dice.tree.structure.Node
frac
 
Constructor Summary
InnerNode()
          Create an InnerNode
 
Method Summary
 void addChild(int v, Node cNode)
          Add a child node for a split attribute value.
 void addChildren(int attrVSize)
          Create childrenIndex and children according the assigned possible number of values of the split attribute.
 void clear()
          Clear the node to reduce the space consumption.
 Node getChild(int v)
          Get the child node according the assigned value of the split attribute.
 
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

attr

public int attr
Split attribute id.


split

public double split
Split value of the split attribute. It is only used for the numeric attribute.


childrenIndex

public int[] childrenIndex
The index array of the children nodes. For nominal split attribute, the number of the elements of this array indicate the child node with the value of the attribute. For example, the nominal split attribute have 0,1,2 three value, then the number 0 means the child is the branch contains the value 0 of the attribute. For numeric split attribute, there are only 3 possible number of the array elements. 0, 1, and 2. 0 means missing value child, 1 indicate the branch less or equals to the split value, and 2 indicate the branch greater than the split value.


children

public Node[] children
The array holds the children node of the node. The corresponding value of these nodes can be found in the childrenIndex.

Constructor Detail

InnerNode

public InnerNode()
Create an InnerNode

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

addChildren

public void addChildren(int attrVSize)
Create childrenIndex and children 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 a deep branch, 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:
attrVSize - The possible number of values of the split attribute.

addChild

public void addChild(int v,
                     Node cNode)
Add a child node for a split attribute value.

Parameters:
v - The value of the split attribute.
cNode - The child node.

getChild

public Node getChild(int v)
Get the child node according the assigned value of the split attribute.

Parameters:
v -
Returns: