Package org.tribuo.common.tree
Class SplitNode<T extends Output<T>>
java.lang.Object
org.tribuo.common.tree.SplitNode<T>
- All Implemented Interfaces:
Serializable
,Node<T>
An immutable
Node
with a split and two child nodes.- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Protobuf serialization version. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncopy()
Copies the node and it's children.boolean
int
Gets the feature ID that this node uses for splitting.The node used if the value is greater than the splitValue.double
The impurity score of this node.The node used if the value is less than or equal to the splitValue.Return the appropriate child node.int
hashCode()
boolean
isLeaf()
Is it a leaf node?double
The threshold value.toString()
-
Field Details
-
CURRENT_VERSION
public static final int CURRENT_VERSIONProtobuf serialization version.- See Also:
-
-
Constructor Details
-
SplitNode
public SplitNode(double splitValue, int featureID, double impurity, Node<T> greaterThan, Node<T> lessThanOrEqual) Constructs a split node with the specified split value, feature id, impurity and child nodes.- Parameters:
splitValue
- The feature value to split on.featureID
- The feature id number.impurity
- The impurity of this node at training time.greaterThan
- The node to take if the feature value is greater than the split value.lessThanOrEqual
- The node to take if the feature value is less than or equal to the split value.
-
-
Method Details
-
getNextNode
Return the appropriate child node. If the splitFeature is not present in the example it's value is treated as zero.- Specified by:
getNextNode
in interfaceNode<T extends Output<T>>
- Parameters:
e
- The example to inspect.- Returns:
- The corresponding child node.
-
isLeaf
public boolean isLeaf()Description copied from interface:Node
Is it a leaf node? -
getImpurity
public double getImpurity()Description copied from interface:Node
The impurity score of this node.- Specified by:
getImpurity
in interfaceNode<T extends Output<T>>
- Returns:
- The node impurity.
-
copy
Description copied from interface:Node
Copies the node and it's children. -
getFeatureID
public int getFeatureID()Gets the feature ID that this node uses for splitting.- Returns:
- The feature ID.
-
splitValue
public double splitValue()The threshold value.- Returns:
- The threshold value.
-
getGreaterThan
The node used if the value is greater than the splitValue.- Returns:
- The greater than node.
-
getLessThanOrEqual
The node used if the value is less than or equal to the splitValue.- Returns:
- The less than or equal to node.
-
toString
-
equals
-
hashCode
public int hashCode()
-