class_docstr: Node that splits the data in a Hoeffding Adaptive Tree Regression.
  
  Parameters
  ----------
  stats
      Target stats.
  depth
      The depth of the node.
  drift_detector
      The detector used to monitor concept drifts.
  attributes
      Other parameters passed to the split node.
class_docstr_tok: ["Node","that","splits","the","data","in","a","Hoeffding","Adaptive","Tree","Regression",".","Parameters","--","--","--","--","--","stats","Target","stats",".","depth","The","depth","of","the","node",".","drift_detector","The","detector","used","to","monitor","concept","drifts",".","attributes","Other","parameters","passed","to","the","split","node","."]
code: def learn_one(
      self, x, y, *, w=1.0, tree=None, parent=None, parent_branch=None
  ):
      leaf = super().traverse(x, until_leaf=True)
      y_pred = leaf.prediction(x, tree=tree)
  
      # Update stats as traverse the tree to improve predictions (in case split nodes are used
      # to provide responses)
      self.stats.update(y, w)
  
      drift_input = abs(y - y_pred)
      old_error = self._error_tracker.mean.get()
  
      self.drift_detector.update(drift_input)
      self._error_tracker.update(drift_input)
      error_change = self.drift_detector.drift_detected
  
      # Error is decreasing, better to keep things as they are
      if error_change and self._error_tracker.mean.get() < old_error:
          # Reset the error estimator
          self._error_tracker = self._error_tracker.clone()
          error_change = False
  
      # Condition to build a new alternate tree
      if error_change and not self._alternate_tree:
          # Reset the error estimator
          self._error_tracker = self._error_tracker.clone()
          self._alternate_tree = tree._new_leaf(parent=self)
          self._alternate_tree.depth -= (
              1  # To ensure we do not skip a tree level
          )
          tree._n_alternate_trees += 1
      # Condition to replace alternate tree
      elif self._alternate_tree:
          alt_n = self._alternate_tree._error_tracker.mean.n
          cur_n = self._error_tracker.mean.n
          # As the size threshold is usually large, we can run a two-tailed z-test to decide whether
          # the alternate subtree has significantly smaller prediction errors than the main subtree
          if (
              alt_n > tree.drift_window_threshold
              and cur_n > tree.drift_window_threshold
          ):
              # Mean prediction error
              alt_mean_er = (
                  self._alternate_tree._error_tracker.mean.get()
              )
              cur_mean_er = self._error_tracker.mean.get()
  
              # Variance of the prediction error
              alt_s2_er = self._alternate_tree._error_tracker.get()
              cur_s2_er = self._error_tracker.get()
  
              # Perform z-test to determine whether mean errors are significantly different
              z = (alt_mean_er - cur_mean_er) / math.sqrt(
                  alt_s2_er / alt_n + cur_s2_er / cur_n
              )
              # We double the p-value due to the double-tailed test
              p_value = 2.0 * tree._norm_dist.cdf(-abs(z))
  
              # The mean errors are significantly different accordingly to the z-test
              if p_value <= tree.switch_significance:
                  # The alternate tree is the best option
                  if alt_mean_er < cur_mean_er:
                      tree._n_active_leaves -= self.n_leaves
                      tree._n_active_leaves += (
                          self._alternate_tree.n_leaves
                      )
                      self.kill_tree_children(tree)
  
                      if parent is not None:
                          parent.children[
                              parent_branch
                          ] = self._alternate_tree
                          self._alternate_tree = None
                      else:
                          # Switch tree root
                          tree._root = tree._root._alternate_tree
                      tree._n_switch_alternate_trees += 1
                  # The current subtree yields the best results
                  else:
                      if isinstance(self._alternate_tree, DTBranch):
                          self._alternate_tree.kill_tree_children(
                              tree
                          )  # noqa
                      self._alternate_tree = None
                      tree._n_pruned_alternate_trees += 1
  
      # Learn one sample in alternate tree and child nodes
      if self._alternate_tree:
          self._alternate_tree.learn_one(
              x,
              y,
              w=w,
              tree=tree,
              parent=parent,
              parent_branch=parent_branch,
          )
      try:
          child = self.next(x)
      except KeyError:
          child = None
  
      if child is not None:
          child.learn_one(
              x,
              y,
              w=w,
              tree=tree,
              parent=self,
              parent_branch=self.branch_no(x),
          )
      else:
          # Instance contains a categorical value previously unseen by the split node
          if self.max_branches() == -1 and self.feature in x:  # noqa
              # Creates a new learning node to encompass the new observed feature value
              leaf = tree._new_leaf(parent=self)
              self.add_child(x[self.feature], leaf)  # noqa
              tree._n_active_leaves += 1
              leaf.learn_one(
                  x,
                  y,
                  w=w,
                  tree=tree,
                  parent=self,
                  parent_branch=self.branch_no(x),
              )
          # The split feature is missing in the instance. Hence, we pass the new example
          # to the most traversed path in the current subtree
          else:
              child_id, child = self.most_common_path()
              child.learn_one(
                  x,
                  y,
                  w=w,
                  tree=tree,
                  parent=self,
                  parent_branch=child_id,
              )
  
imports: from __future__ import annotations
  import math
  from river import stats
  from river.utils.random import poisson
  from .branch import DTBranch, NominalBinaryBranch, NominalMultiwayBranch, NumericBinaryBranch, NumericMultiwayBranch
  from .htr_nodes import LeafAdaptive, LeafMean, LeafModel
  from .leaf import HTLeaf
label_desc: Use image node_id 4 for calling the AdaBranchRegressor obj's underlying member method code with example usage: obj.learn_one(x, y) without return types