class_docstr: Mondrian Tree Regressor.
  
  Parameters
  ----------
  step
      Step of the tree.
  use_aggregation
      Whether to use aggregation weighting techniques or not.
  iteration
      Number iterations to do during training.
  seed
      Random seed for reproducibility.
  
  Notes
  -----
  The Mondrian Tree Regressor is a type of decision tree that bases splitting decisions over a
  Mondrian process.
  
  References
  ----------
  [^1]: Balaji Lakshminarayanan, Daniel M. Roy, Yee Whye Teh. Mondrian Forests: Efficient Online Random Forests.
      arXiv:1406.2673, pages 2-4.
class_docstr_tok: ["Mondrian","Tree","Regressor",".","Parameters","--","--","--","--","--","step","Step","of","the","tree",".","use_aggregation","Whether","to","use","aggregation","weighting","techniques","or","not",".","iteration","Number","iterations","to","do","during","training",".","seed","Random","seed","for","reproducibility",".","Notes","--","--","-","The","Mondrian","Tree","Regressor","is","a","type","of","decision","tree","that","bases","splitting","decisions","over","a","Mondrian","process",".","References","--","--","--","--","--","[","^1","]",":","Balaji","Lakshminarayanan",",","Daniel","M.","Roy",",","Yee","Whye","Teh",".","Mondrian","Forests",":","Efficient","Online","Random","Forests",".","arXiv:1406.2673",",","pages","2-4","."]
docstr: Split the given node and attributes the split time, threshold, etc... to the node.
  
  Parameters
  ----------
  node
      Target node.
  split_time
      Split time of the node in the Mondrian process.
  threshold
      Threshold of acceptance of the node.
  feature
      Feature index of the node.
  is_right_extension
      Should we extend the tree in the right or left direction.
docstr_tok: ["Split","the","given","node","and","attributes","the","split","time",",","threshold",",","etc","...","to","the","node",".","Parameters","--","--","--","--","--","node","Target","node",".","split_time","Split","time","of","the","node","in","the","Mondrian","process",".","threshold","Threshold","of","acceptance","of","the","node",".","feature","Feature","index","of","the","node",".","is_right_extension","Should","we","extend","the","tree","in","the","right","or","left","direction","."]
code: def _split(
      self,
      node: MondrianLeafRegressor | MondrianBranchRegressor,
      split_time: float,
      threshold: float,
      feature: base.typing.FeatureName,
      is_right_extension: bool,
  ) -> MondrianBranchRegressor:
      """Split the given node and attributes the split time, threshold, etc... to the node.
  
      Parameters
      ----------
      node
          Target node.
      split_time
          Split time of the node in the Mondrian process.
      threshold
          Threshold of acceptance of the node.
      feature
          Feature index of the node.
      is_right_extension
          Should we extend the tree in the right or left direction.
  
      """
  
      new_depth = node.depth + 1
  
      # To calm down mypy
      left: MondrianLeafRegressor | MondrianBranchRegressor
      right: MondrianLeafRegressor | MondrianBranchRegressor
  
      # The node is already a branch: we create a new branch above it and move the existing
      # node one level down the tree
      if isinstance(node, MondrianBranchRegressor):
          old_left, old_right = node.children
          if is_right_extension:
              left = MondrianBranchRegressor(
                  node,
                  split_time,
                  new_depth,
                  node.feature,
                  node.threshold,
              )
              right = MondrianLeafRegressor(node, split_time, new_depth)
              left.replant(node)
  
              old_left.parent = left
              old_right.parent = left
  
              left.children = (old_left, old_right)
          else:
              right = MondrianBranchRegressor(
                  node,
                  split_time,
                  new_depth,
                  node.feature,
                  node.threshold,
              )
              left = MondrianLeafRegressor(node, split_time, new_depth)
              right.replant(node)
  
              old_left.parent = right
              old_right.parent = right
  
              right.children = (old_left, old_right)
  
          # Update the level of the modified nodes
          new_depth += 1
          old_left.update_depth(new_depth)
          old_right.update_depth(new_depth)
  
          # Update split info
          node.feature = feature
          node.threshold = threshold
          node.children = (left, right)
  
          return node
  
      # We promote the leaf to a branch
      branch = MondrianBranchRegressor(
          node.parent, node.time, node.depth, feature, threshold
      )
      left = MondrianLeafRegressor(branch, split_time, new_depth)
      right = MondrianLeafRegressor(branch, split_time, new_depth)
      branch.children = (left, right)
  
      # Copy properties from the previous leaf
      branch.replant(node, True)
  
      if is_right_extension:
          left.replant(node)
      else:
          right.replant(node)
  
      # To avoid leaving garbage behind
      del node
  
      return branch
  
file_path: river/river/tree/mondrian/mondrian_tree_regressor.py
imports: from __future__ import annotations
  import math
  from river import base, utils
  from river.tree.mondrian.mondrian_tree import MondrianTree
  from river.tree.mondrian.mondrian_tree_nodes import MondrianBranchRegressor, MondrianLeafRegressor, MondrianNodeRegressor
label_desc: Use image node_id 8 for calling the MondrianTreeRegressor obj's underlying member method code with example usage: obj._split(node, split_time, threshold, feature, is_right_extension) and returns: branch, node