Package smile.base.cart
Class OrdinalNode
java.lang.Object
smile.base.cart.InternalNode
smile.base.cart.OrdinalNode
- All Implemented Interfaces:
Serializable
,Node
A node with an ordinal split variable (real-valued or ordinal categorical value).
- See Also:
-
Constructor Summary
ConstructorDescriptionOrdinalNode
(int feature, double value, double score, double deviance, Node trueChild, Node falseChild) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns true if the instance goes to the true branch.dot
(StructType schema, StructField response, int id) Returns the dot representation of node.Evaluate the tree over an instance.Returns a new internal node with children replaced.toString
(StructType schema, boolean trueBranch) Returns the string representation of branch.
-
Constructor Details
-
OrdinalNode
public OrdinalNode(int feature, double value, double score, double deviance, Node trueChild, Node falseChild) Constructor.- Parameters:
feature
- the index of feature column.value
- the split value.score
- the split score.deviance
- the deviance.trueChild
- the true branch child.falseChild
- the false branch child.
-
-
Method Details
-
predict
Description copied from interface:Node
Evaluate the tree over an instance.- Specified by:
predict
in interfaceNode
- Specified by:
predict
in classInternalNode
- Parameters:
x
- the instance.- Returns:
- the leaf node that the instance falls into.
-
branch
Description copied from class:InternalNode
Returns true if the instance goes to the true branch.- Specified by:
branch
in classInternalNode
- Parameters:
x
- the instance.- Returns:
- true if the instance goes to the true branch.
-
replace
Description copied from class:InternalNode
Returns a new internal node with children replaced.- Specified by:
replace
in classInternalNode
- Parameters:
trueChild
- the new true branch child.falseChild
- the new false branch child.- Returns:
- a new internal node with children replaced.
-
dot
Description copied from interface:Node
Returns the dot representation of node.- Parameters:
schema
- the schema of dataresponse
- the schema of response variableid
- node id- Returns:
- the dot representation of node.
-
toString
Description copied from class:InternalNode
Returns the string representation of branch.- Specified by:
toString
in classInternalNode
- Parameters:
schema
- the schema of data.trueBranch
- for true or false branch.- Returns:
- the string representation of branch.
-