Class AbstractTrainingNode<T extends Output<T>>

java.lang.Object
org.tribuo.common.tree.AbstractTrainingNode<T>
All Implemented Interfaces:
Serializable, Node<T>
Direct Known Subclasses:
ClassifierTrainingNode, JointRegressorTrainingNode, RegressorTrainingNode

public abstract class AbstractTrainingNode<T extends Output<T>> extends Object implements Node<T>
Base class for decision tree nodes used at training time.
See Also:
  • Field Details

  • Constructor Details

    • AbstractTrainingNode

      protected AbstractTrainingNode(int depth, int numExamples)
      Builds an abstract training node.
      Parameters:
      depth - The depth of this node.
      numExamples - The number of examples in this node.
  • Method Details

    • buildTree

      public abstract List<AbstractTrainingNode<T>> buildTree(int[] indices)
    • convertTree

      public abstract Node<T> convertTree()
      Converts a tree from a training representation to the final inference time representation.
      Returns:
      The converted subtree.
    • getDepth

      public int getDepth()
      The depth of this node in the tree.
      Returns:
      The depth.
    • getNextNode

      public Node<T> getNextNode(SparseVector example)
      Description copied from interface: Node
      Returns the next node in the tree based on the supplied example, or null if it's a leaf.
      Specified by:
      getNextNode in interface Node<T extends Output<T>>
      Parameters:
      example - The example.
      Returns:
      The next node down in the tree.
    • getNumExamples

      public int getNumExamples()
      The number of training examples in this node.
      Returns:
      The number of training examples in this node.
    • isLeaf

      public boolean isLeaf()
      Description copied from interface: Node
      Is it a leaf node?
      Specified by:
      isLeaf in interface Node<T extends Output<T>>
      Returns:
      True if it's a leaf node.
    • copy

      public Node<T> copy()
      Description copied from interface: Node
      Copies the node and it's children.
      Specified by:
      copy in interface Node<T extends Output<T>>
      Returns:
      A deep copy.