protected static class DecisionTree.Node extends TreeNodeVisitor
Modifier and Type | Field and Description |
---|---|
protected DecisionTree.Node[] |
paths |
protected DecisionStump |
stump |
Constructor and Description |
---|
Node(DecisionStump stump) |
Modifier and Type | Method and Description |
---|---|
int |
childrenCount()
Returns the number of children this node of the tree has, and may return
a non zero value even if the node is a leaf
|
DecisionTree.Node |
clone() |
void |
disablePath(int child)
Disables the selected path to the specified child from the current node.
|
Collection<Integer> |
featuresUsed()
Returns a collection of the indices of the features used by this node in
the tree to make its decision about what branch to use next.
|
TreeNodeVisitor |
getChild(int child)
Returns the node for the specific child, or null if the child index was
not valid
|
int |
getPath(DataPoint dp)
Returns the path down the tree the given data point would have taken, or
-1 if this node was a leaf node OR if a missing value prevent traversal
down the path
|
double |
getPathWeight(int path)
Returns the relative weight of each path, which should be an indication
of how much of the training data went down each path.
|
boolean |
isLeaf()
Returns true if the node is a leaf, meaning it has no valid paths to any
children
|
boolean |
isPathDisabled(int child)
Returns true if the path to the specified child is disabled, meaning it
can not be traveled to.
|
CategoricalResults |
localClassify(DataPoint dp)
Returns the classification result that would have been obtained if the
current node was a leaf node.
|
double |
localRegress(DataPoint dp)
Returns the regression result that would have been obtained if the
current node was a leaf node.
|
void |
setPath(int child,
TreeNodeVisitor node)
Optional operation!
This method, if supported, will set the path so that the child is set to the given value. |
classify, regress
protected final DecisionStump stump
protected DecisionTree.Node[] paths
public Node(DecisionStump stump)
public double getPathWeight(int path)
TreeNodeVisitor
TreeNodeVisitor.childrenCount()
. The result should sum to onegetPathWeight
in class TreeNodeVisitor
path
- the path to selectpublic boolean isLeaf()
TreeNodeVisitor
isLeaf
in class TreeNodeVisitor
public int childrenCount()
TreeNodeVisitor
childrenCount
in class TreeNodeVisitor
public CategoricalResults localClassify(DataPoint dp)
TreeNodeVisitor
localClassify
in class TreeNodeVisitor
dp
- the data point to localClassifypublic double localRegress(DataPoint dp)
TreeNodeVisitor
localRegress
in class TreeNodeVisitor
dp
- the data point to regresspublic DecisionTree.Node clone()
clone
in class TreeNodeVisitor
public TreeNodeVisitor getChild(int child)
TreeNodeVisitor
getChild
in class TreeNodeVisitor
child
- the index of the child node to obtainpublic void setPath(int child, TreeNodeVisitor node)
TreeNodeVisitor
setPath
in class TreeNodeVisitor
child
- the child pathnode
- the node to make the childpublic void disablePath(int child)
TreeNodeVisitor
disablePath
in class TreeNodeVisitor
child
- the index of the child to disable the path toopublic int getPath(DataPoint dp)
TreeNodeVisitor
getPath
in class TreeNodeVisitor
dp
- the data point to send down the treepublic boolean isPathDisabled(int child)
TreeNodeVisitor
isPathDisabled
in class TreeNodeVisitor
child
- the child index to check the path forpublic Collection<Integer> featuresUsed()
TreeNodeVisitor
featuresUsed
in class TreeNodeVisitor
Copyright © 2017. All rights reserved.