javax.datamining.modeldetail.tree
Interface TreeNode


public interface TreeNode

A TreeNode characterizes a partition of a multidimensional dataset. It holds metadata that results from a tree model build. This information forms part of a rule that can be used to score the data with respect to the target. A node's ancestor nodes contain the set of predicates which form a sub-rule that classify the rows of a dataset as being in or not in the node.

A TreeNode represents a node in a decision tree. A node's predicate, if any, defines its child nodes. Nodes without children are called leaves. The set of leaves in the selected subtree form the tree model's final partitioning of the multidimensional data. Nodes may contain surrogates, which are secondary predicates used when the requisite data for the primary predicate are missing.

In addition, a TreeNode may contain a score distribution which characterizes the distribution of data at that node with respect to a reference dataset.

Author:
JSR-73 Java Data Mining Expert Group

Method Summary
 TreeNode[] getAncestors()
          Returns all ancestors of this node or null if the node is a root node.
 long getCaseCount()
          Returns the number of cases assigned to this tree node.
 TreeNode[] getChildren()
          Returns the direct children of this node or null if the node is a leaf node.
 int getIdentifier()
          Returns the identifier of the node assigned by the algorithm.
 int getLevel()
          Returns the level of this node where level(root)=0.
 AttributeStatisticsSet getNodeStatistics()
          Returns the statistics of the partition represented by this node or null if no statistics are provided.
 int getNumberOfChildren()
          Returns the number of children available for this tree node.
 TreeNode getParent()
          Returns the parent of this node or null if the node has no parent.
 Predicate getPredicate()
          Returns the rule that is used to split the parent node and leads to this node.
 java.lang.Object getPrediction()
          Returns the predicted target value of this node.
 PredictionType getPredictionType()
          Returns the type of the prediction.
 Predicate[] getSurrogates()
          Returns an ordered array of predicates used during scoring when the primary splitting attribute is missing.
 long getTargetCount(java.lang.Object target)
          Returns the number of cases associated with the specified target.
 long[] getTargetCounts()
          Returns the array of target counts in the same order as in an array of target values obtained from a CategorySet that are returned from ClassificationModel.getTargetCategorySet.
 boolean isLeaf()
          Returns boolean indicating whether this node is a leaf (terminal node).
 

Method Detail

getAncestors

public TreeNode[] getAncestors()
                        throws JDMException
Returns all ancestors of this node or null if the node is a root node.

Returns:
TreeNode[]
Throws:
JDMException

getCaseCount

public long getCaseCount()
Returns the number of cases assigned to this tree node.

Returns:
long

getChildren

public TreeNode[] getChildren()
                       throws JDMException
Returns the direct children of this node or null if the node is a leaf node.

Returns:
TreeNode[]
Throws:
JDMException

getIdentifier

public int getIdentifier()
Returns the identifier of the node assigned by the algorithm. Assignment of an identifier is implementation specific.

Returns:
int

getLevel

public int getLevel()
Returns the level of this node where level(root)=0.

Returns:
int

getNodeStatistics

public AttributeStatisticsSet getNodeStatistics()
                                         throws JDMException
Returns the statistics of the partition represented by this node or null if no statistics are provided.

Returns:
AttributeStatisticsSet
Throws:
JDMException

getNumberOfChildren

public int getNumberOfChildren()
Returns the number of children available for this tree node.

Returns:
int

getParent

public TreeNode getParent()
                   throws JDMException
Returns the parent of this node or null if the node has no parent.

Returns:
TreeNode
Throws:
JDMException

getPredicate

public Predicate getPredicate()
Returns the rule that is used to split the parent node and leads to this node. The root node does not have a predicate and returns null.

Returns:
Predicate

getPrediction

public java.lang.Object getPrediction()
Returns the predicted target value of this node.

Returns:
Object

getPredictionType

public PredictionType getPredictionType()
Returns the type of the prediction.

Returns:
PredictionType

getSurrogates

public Predicate[] getSurrogates()
Returns an ordered array of predicates used during scoring when the primary splitting attribute is missing. The order indicates the preference use.

Returns:
Predicate[]

getTargetCount

public long getTargetCount(java.lang.Object target)
                    throws JDMException
Returns the number of cases associated with the specified target. The target values can be obtained from a CategorySet that are returned from ClassificationModel.getTargetCategorySet.

Parameters:
target -
Returns:
long
Throws:
JDMException

getTargetCounts

public long[] getTargetCounts()
Returns the array of target counts in the same order as in an array of target values obtained from a CategorySet that are returned from ClassificationModel.getTargetCategorySet. The full array is returned with zeros for the target values that are not present in the node.

Returns:
long[]

isLeaf

public boolean isLeaf()
Returns boolean indicating whether this node is a leaf (terminal node).

Returns:
boolean