Class NominalNode

java.lang.Object
smile.base.cart.InternalNode
smile.base.cart.NominalNode
All Implemented Interfaces:
Serializable, Node

public class NominalNode extends InternalNode
A node with a nominal split variable.
See Also:
  • 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

      public LeafNode predict(Tuple x)
      Description copied from interface: Node
      Evaluate the tree over an instance.
      Specified by:
      predict in interface Node
      Specified by:
      predict in class InternalNode
      Parameters:
      x - the instance.
      Returns:
      the leaf node that the instance falls into.
    • branch

      public boolean branch(Tuple x)
      Description copied from class: InternalNode
      Returns true if the instance goes to the true branch.
      Specified by:
      branch in class InternalNode
      Parameters:
      x - the instance.
      Returns:
      true if the instance goes to the true branch.
    • replace

      public NominalNode replace(Node trueChild, Node falseChild)
      Description copied from class: InternalNode
      Returns a new internal node with children replaced.
      Specified by:
      replace in class InternalNode
      Parameters:
      trueChild - the new true branch child.
      falseChild - the new false branch child.
      Returns:
      a new internal node with children replaced.
    • dot

      public String dot(StructType schema, StructField response, int id)
      Description copied from interface: Node
      Returns the dot representation of node.
      Parameters:
      schema - the schema of data
      response - the schema of response variable
      id - node id
      Returns:
      the dot representation of node.
    • toString

      public String toString(StructType schema, boolean trueBranch)
      Description copied from class: InternalNode
      Returns the string representation of branch.
      Specified by:
      toString in class InternalNode
      Parameters:
      schema - the schema of data.
      trueBranch - for true or false branch.
      Returns:
      the string representation of branch.