gov.sandia.cognition.learning.algorithm.tree
Interface DecisionTreeNode<InputType,OutputType>

Type Parameters:
InputType - The input type of the decision tree to evaluate
OutputType - The output type that the decision tree returns.
All Superinterfaces:
Cloneable, CloneableSerializable, Serializable
All Known Implementing Classes:
AbstractDecisionTreeNode, CategorizationTreeNode, RegressionTreeNode

public interface DecisionTreeNode<InputType,OutputType>
extends CloneableSerializable

The DecisionTreeNode interface defines the functionality of a node in a decision tree. In particular, it defines how to get the child nodes plus how to get the output for a leaf node.

Since:
2.0
Author:
Justin Basilico

Method Summary
 DecisionTreeNode<InputType,OutputType> chooseChild(InputType input)
          Chooses the child node corresponding to the given input.
 Collection<? extends DecisionTreeNode<InputType,OutputType>> getChildren()
          Gets the collection of children of the node.
 int getDepth()
          Gets the depth of the node in the tree.
 Object getIncomingValue()
          Gets the label of the incoming value to the node.
 OutputType getOutput(InputType input)
          Gets the local output of this node for the given input.
 DecisionTreeNode<InputType,OutputType> getParent()
          Gets the parent node for this node.
 int getTreeSize()
          Gets the size of the sub-tree from this node.
 boolean isLeaf()
          Returns true if this node is a leaf node (has no children) and false otherwise.
 
Methods inherited from interface gov.sandia.cognition.util.CloneableSerializable
clone
 

Method Detail

getParent

DecisionTreeNode<InputType,OutputType> getParent()
Gets the parent node for this node. Null if it is the root node.

Returns:
The parent node for this node.

getChildren

Collection<? extends DecisionTreeNode<InputType,OutputType>> getChildren()
Gets the collection of children of the node.

Returns:
The collection of children of the node.

isLeaf

boolean isLeaf()
Returns true if this node is a leaf node (has no children) and false otherwise.

Returns:
True if this is a leaf node; false otherwise.

chooseChild

DecisionTreeNode<InputType,OutputType> chooseChild(InputType input)
Chooses the child node corresponding to the given input. If there is no corresponding child node, then null is returned.

Parameters:
input - The input.
Returns:
The corresponding child node for the given input, if one exists; otherwise, null.

getOutput

OutputType getOutput(InputType input)
Gets the local output of this node for the given input. This is done to determine the output value for a leaf node or the output value in the case that there is no corresponding child node for an input.

Parameters:
input - The input.
Returns:
The local output value for the given input.

getIncomingValue

Object getIncomingValue()
Gets the label of the incoming value to the node.

Returns:
The incoming value to the node, if any.

getDepth

int getDepth()
Gets the depth of the node in the tree.

Returns:
The depth of the node. The root is depth 1.

getTreeSize

int getTreeSize()
Gets the size of the sub-tree from this node.

Returns:
The size of the sub-tree rooted at this node. Must be positive.