Class NominalNode
java.lang.Object
smile.base.cart.InternalNode
smile.base.cart.NominalNode
- All Implemented Interfaces:
Serializable, Node
-
Constructor Summary
ConstructorsConstructorDescriptionNominalNode(int feature, int value, double score, double deviance, Node trueChild, Node falseChild) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns 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
-
NominalNode
public NominalNode(int feature, int 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
-
branch
Description copied from class:InternalNodeReturns true if the instance goes to the true branch.- Specified by:
branchin classInternalNode- Parameters:
x- the instance.- Returns:
- true if the instance goes to the true branch.
-
replace
Description copied from class:InternalNodeReturns a new internal node with children replaced.- Specified by:
replacein 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:NodeReturns 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:InternalNodeReturns the string representation of branch.- Specified by:
toStringin classInternalNode- Parameters:
schema- the schema of data.trueBranch- for true or false branch.- Returns:
- the string representation of branch.
-