public abstract class InternalNode extends java.lang.Object implements Node
Constructor and Description |
---|
InternalNode(int feature,
double score,
double deviance,
Node trueChild,
Node falseChild) |
Modifier and Type | Method and Description |
---|---|
abstract boolean |
branch(smile.data.Tuple x)
Returns true if the instance goes to the true branch.
|
int |
depth()
Returns the maximum depth of the tree -- the number of
nodes along the longest path from this node
down to the farthest leaf node.
|
double |
deviance()
Returns the deviance of node.
|
Node |
falseChild()
Returns the false branch child.
|
int |
feature()
Returns the split feature.
|
int |
leafs()
Returns the number of leaf nodes in the subtree.
|
Node |
merge()
Try to merge the children nodes and return a leaf node.
|
abstract LeafNode |
predict(smile.data.Tuple x)
Evaluates the tree over an instance.
|
abstract InternalNode |
replace(Node trueChild,
Node falseChild)
Returns a new internal node with children replaced.
|
double |
score()
Returns the split score (reduction of impurity).
|
int |
size()
Returns the number of samples in the node.
|
abstract java.lang.String |
toString(smile.data.type.StructType schema,
boolean trueBranch)
Returns the string representation of branch.
|
int[] |
toString(smile.data.type.StructType schema,
smile.data.type.StructField response,
InternalNode parent,
int depth,
java.math.BigInteger id,
java.util.List<java.lang.String> lines)
Adds the string representation (R's rpart format) to a collection.
|
Node |
trueChild()
Returns the true branch child.
|
public abstract LeafNode predict(smile.data.Tuple x)
public abstract boolean branch(smile.data.Tuple x)
public abstract InternalNode replace(Node trueChild, Node falseChild)
public Node trueChild()
public Node falseChild()
public int feature()
public double score()
public int size()
Node
public int leafs()
Node
public double deviance()
Node
public int depth()
Node
public Node merge()
Node
public abstract java.lang.String toString(smile.data.type.StructType schema, boolean trueBranch)
schema
- the schema of data.trueBranch
- for true or false branch.public int[] toString(smile.data.type.StructType schema, smile.data.type.StructField response, InternalNode parent, int depth, java.math.BigInteger id, java.util.List<java.lang.String> lines)
Node
toString
in interface Node
schema
- the schema of dataresponse
- the schema of response variableparent
- the parent nodedepth
- the depth of node in the tree. The root node is at depth 0.id
- node idlines
- the collection of node's string representation.