Package com.imsl.datamining.decisionTree
Class TreeNode
java.lang.Object
com.imsl.datamining.decisionTree.TreeNode
- All Implemented Interfaces:
Serializable,Cloneable
A
DecisionTree node that is a child node of Tree.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected TreeNodeclone()Returns a clone of aTreeNode.intgetChildId(int i) Returns the id of a child node.int[]Returns the array of child node id's.doublegetCost()Returns the misclassification cost of a node (in-sample cost measure at the current node).intReturns the id of the current node.doubleReturns the value of the split criteria at the node.doubleReturns the value around which the node may be split, if the split variable is of a continuous type.intgetNodeValueIndicator(int i) Returns the indicator value for thei-th value of the split variable in the current node, if the split variable is categoricalint[]Returns the array indicating which values of the split variable apply in the current node, if the split variable is of discrete type.intReturns the id of the variable that defines the split in the current node.doubleReturns the number of cases in the training data that fall into the current node.intReturns the number of child nodes associated with the current node.intReturns the id of the parent node of the current node.intReturns the predicted class at the current node, for response variables of categorical type.doubleReturns the predicted value at the current node for response variables of continuous type.double[]Returns the surrogate split information array.doublegetSurrogateInfo(int i) Returns a value from the surrogate split information array.doublegetYProb(int i) Returns a class probability at the current node, if the response variable is of categorical type.double[]Returns the class probabilities at the current node, if the response variable is of categorical type.
-
Constructor Details
-
TreeNode
public TreeNode()Constructs aDecisionTreeNodeobject.
-
-
Method Details
-
getChildId
public int getChildId(int i) Returns the id of a child node.- Parameters:
i- anintspecifying the index of the child node- Returns:
- an
int, the id of the child node at indexi
-
getChildrenIds
public int[] getChildrenIds()Returns the array of child node id's.Note that the length of this array may exceed the actual number of child nodes. Use
getNumberOfChildren()to determine the actual number of children.- Returns:
- an
intarray containing id's of the child nodes
-
getCost
public double getCost()Returns the misclassification cost of a node (in-sample cost measure at the current node).- Returns:
- a
double, the misclassification cost of a node
-
getNodeId
public int getNodeId()Returns the id of the current node.The root node has
nodeId= 0.- Returns:
- an
int, the node id
-
getNodeSplitValue
public double getNodeSplitValue()Returns the value around which the node may be split, if the split variable is of a continuous type.- Returns:
- a
double, the value around which the node may be split
-
getNodeSplitCriteriaValue
public double getNodeSplitCriteriaValue()Returns the value of the split criteria at the node.- Returns:
- a
double, the value of the split criteria at the node
-
getNodeValuesIndicator
public int[] getNodeValuesIndicator()Returns the array indicating which values of the split variable apply in the current node, if the split variable is of discrete type.The array at index
iwill be 1 if thei-th value of the discrete variable belongs in the node. If it does not belong to the node, the array has value 0.- Returns:
- an
intarray containing the indicators
-
getNodeValueIndicator
public int getNodeValueIndicator(int i) Returns the indicator value for thei-th value of the split variable in the current node, if the split variable is categorical- Returns:
- an
int, that if 0, the value is not in the node; if 1, it is in the node, meaning that it is in the subset that defines the data partition of the node
-
getNodeVariableId
public int getNodeVariableId()Returns the id of the variable that defines the split in the current node.- Returns:
- an
int, the variable that defines the split in the current node
-
getNumberOfCases
public double getNumberOfCases()Returns the number of cases in the training data that fall into the current node.- Returns:
- a
double, the number of cases (or total case weight) in the training data that fall into the current node
-
getNumberOfChildren
public int getNumberOfChildren()Returns the number of child nodes associated with the current node.- Returns:
- an
int, the number of child nodes associated with thisTreeNodeinstance
-
getParentId
public int getParentId()Returns the id of the parent node of the current node.- Returns:
- an
int, the id of the parent node
-
getPredictedClass
public int getPredictedClass()Returns the predicted class at the current node, for response variables of categorical type.- Returns:
- an
int, the predicted class
-
getPredictedVal
public double getPredictedVal()Returns the predicted value at the current node for response variables of continuous type.- Returns:
- a
double, the predicted value at the current node
-
getSurrogateInfo
public double getSurrogateInfo(int i) Returns a value from the surrogate split information array.- Parameters:
i- anintspecifying which value to return- Returns:
- a
double, the value at indexi
-
getSurrogateInfo
public double[] getSurrogateInfo()Returns the surrogate split information array.- Returns:
- a
doublearray containing the surrogate split values
-
getYProb
public double getYProb(int i) Returns a class probability at the current node, if the response variable is of categorical type.- Parameters:
i- anintspecifying the index of the class- Returns:
- a
double, the probability of the class at indexi
-
getYProbs
public double[] getYProbs()Returns the class probabilities at the current node, if the response variable is of categorical type.- Returns:
- a
doublearray containing the class probabilities at the current node
-
clone
Returns a clone of aTreeNode.
-