Node

In BartPy, Trees are made up of two types of Nodes:
  1. DecisionNodes - representing binary splits of feature space
  2. LeafNodes - representing the final grouping of points together

Each Node maps to a Split class which contains all of the information about how a Node relates to data

class bartpy.node.DecisionNode(split: bartpy.split.Split, left_child_node: typing.Union[bartpy.node.LeafNode, _ForwardRef('DecisionNode')], right_child_node: typing.Union[bartpy.node.LeafNode, _ForwardRef('DecisionNode')], depth=0)[source]

A DecisionNode encapsulates internal node in the tree Unlike a LeafNode, it contains very little actual logic beyond tying the tree together

class bartpy.node.LeafNode(split: bartpy.split.Split, depth=0)[source]

A representation of a leaf node in the tree In addition to the normal work of a Node, a LeafNode is responsible for:

  • Interacting with Data
  • Making predictions
class bartpy.node.TreeNode(split: bartpy.split.Split, depth: int, left_child: typing.Union[bartpy.node.TreeNode, NoneType] = None, right_child: typing.Union[bartpy.node.TreeNode, NoneType] = None)[source]

A representation of a node in the Tree Contains two main types of information:

  • Data relevant for the node
  • Links to children nodes
bartpy.node.split_node(node: bartpy.node.LeafNode, split_condition: bartpy.split.SplitCondition) → bartpy.node.DecisionNode[source]

Converts a LeafNode into an internal DecisionNode by applying the split condition The left node contains all values for the splitting variable less than the splitting value