public class TreeNode extends Object implements Serializable, Cloneable
DecisionTree
node which may be used as a child of Tree
.Constructor and Description |
---|
TreeNode()
Constructs a
DecisionTreeNode object. |
Modifier and Type | Method and Description |
---|---|
protected TreeNode |
clone()
Returns a clone of a
TreeNode . |
int |
getChildId(int i)
Returns the id of a child node.
|
int[] |
getChildrenIds()
Returns the array of child node id's.
|
double |
getCost()
Returns the misclassification cost of a node (in-sample cost measure at
the current node).
|
int |
getNodeId()
Returns the id of the current node.
|
double |
getNodeSplitValue()
Returns the value around which the node may be split, if the split
variable is of a continuous type.
|
int |
getNodeValueIndicator(int i)
Returns the indicator value for the
i- th value of the split
variable in the current node, if the split variable is of discrete type. |
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.
|
int |
getNodeVariableId()
Returns the id of the variable that defines the split in the current
node.
|
double |
getNumberOfCases()
Returns the number of cases in the training data that fall into the
current node.
|
int |
getNumberOfChildren()
Returns the number of child nodes associated with the current node.
|
int |
getParentId()
Returns the id of the parent node of the current node.
|
int |
getPredictedClass()
Returns the predicted class at the current node, for response variables
of categorical type.
|
double |
getPredictedVal()
Returns the predicted value at the current node, for response variables
of continuous type.
|
double[] |
getSurrogateInfo()
Returns the surrogate split information array.
|
double |
getSurrogateInfo(int i)
Returns a value from the surrogate split information array.
|
double |
getYProb(int i)
Returns a class probability at the current node, if the response variable
is of categorical type.
|
double[] |
getYProbs()
Returns class probabilities at the current node, if the response variable
is of categorical type.
|
void |
setNumberOfChildren(int nChildren)
Sets the number of child nodes associated with the current node.
|
void |
setSurrogateInfo(double[] surrogateInfo)
Sets the surrogate split information.
|
void |
setYProb(int i,
double val)
Sets a class probability at the current node, if the response variable is
of categorical type.
|
protected TreeNode clone()
TreeNode
.public int getChildId(int i)
i
- an int
specifying the index of the child node.int
which is the id of the specified node.public int[] getChildrenIds()
Note that the length of this array may exceed the actual number of child
nodes. Use getNumberOfChildren()
to determine the actual number
of children.
int
array containing id's of the child nodes.public double getCost()
double
specifying the misclassification cost of a
node.public int getNodeId()
The root node has nodeId
= 0.
int
which is the node id.public double getNodeSplitValue()
double
which is the value around which the node
may be split.public int getNodeValueIndicator(int i)
i-
th value of the split
variable in the current node, if the split variable is of discrete type.int
which 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.public int[] getNodeValuesIndicator()
int
array of indicators.public int getNodeVariableId()
int
identifying the variable that defines the
split in the current node.public double getNumberOfCases()
double
indicating the number of cases (or total
case weight) in the training data that fall into the current node.public int getNumberOfChildren()
int
that indicates the number of child nodes
associated with this TreeNode
instance.public int getParentId()
int
which is the id of the parent node.public int getPredictedClass()
int
which indicates the predicted class.public double getPredictedVal()
double
that indicates the value of the response
variable.public double[] getSurrogateInfo()
double
array containing the surrogate split
values.public double getSurrogateInfo(int i)
i
- an int
specifying which value to return.double
which equals the value at index
i
.public double getYProb(int i)
i
- an int
specifying which class of the response
variable.double
which is the specified class probability at
the current node.public double[] getYProbs()
double
array of class probabilities at the current
node.public void setNumberOfChildren(int nChildren)
nChildren
- an int
that indicates the number of child
nodes associated with this TreeNode
instance.public void setSurrogateInfo(double[] surrogateInfo)
surrogateInfo
- a double
array containing the surrogate
split information.public void setYProb(int i, double val)
i
- an int
specifying which class of the response
variable.val
- a double
which specifies the indicated class
probability at the current node.Copyright © 1970-2015 Rogue Wave Software
Built October 13 2015.