Package smile.base.cart
Class LeafNode
java.lang.Object
smile.base.cart.LeafNode
- All Implemented Interfaces:
Serializable
,Node
- Direct Known Subclasses:
DecisionNode
,RegressionNode
A leaf node in decision tree.
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
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.int
leaves()
Returns the number of leaf nodes in the subtree.merge()
Try to merge the children nodes and return a leaf node.Evaluate the tree over an instance.int
size()
Returns the number of samples in the node.
-
Field Details
-
size
protected final int sizeThe number of samples in the node.
-
-
Constructor Details
-
LeafNode
public LeafNode(int size) Constructor.- Parameters:
size
- the number of samples in the node
-
-
Method Details
-
size
public int size()Description copied from interface:Node
Returns the number of samples in the node. -
leaves
public int leaves()Description copied from interface:Node
Returns the number of leaf nodes in the subtree. -
predict
Description copied from interface:Node
Evaluate the tree over an instance. -
depth
public int depth()Description copied from interface:Node
Returns the maximum depth of the tree -- the number of nodes along the longest path from this node down to the farthest leaf node. -
merge
Description copied from interface:Node
Try to merge the children nodes and return a leaf node. If not able to merge, return this node itself.
-