class_docstr: Hoeffding Adaptive Tree regressor (HATR).
  
  This class implements a regression version of the Hoeffding Adaptive Tree Classifier. Hence,
  it also uses an ADWIN concept-drift detector instance at each decision node to monitor
  possible changes in the data distribution. If a drift is detected in a node, an alternate
  tree begins to be induced in the background. When enough information is gathered, HATR
  swaps the node where the change was detected by its alternate tree.
  
  Parameters
  ----------
  grace_period
      Number of instances a leaf should observe between split attempts.
  max_depth
      The maximum depth a tree can reach. If `None`, the tree will grow indefinitely.
  delta
      Significance level to calculate the Hoeffding bound. The significance level is given by
      `1 - delta`. Values closer to zero imply longer split decision delays.
  tau
      Threshold below which a split will be forced to break ties.
  leaf_prediction
      Prediction mechanism used at leafs.</br>
      - 'mean' - Target mean</br>
      - 'model' - Uses the model defined in `leaf_model`</br>
      - 'adaptive' - Chooses between 'mean' and 'model' dynamically</br>
  leaf_model
      The regression model used to provide responses if `leaf_prediction='model'`. If not
      provided an instance of `river.linear_model.LinearRegression` with the default
      hyperparameters is used.
  model_selector_decay
      The exponential decaying factor applied to the learning models' squared errors, that
      are monitored if `leaf_prediction='adaptive'`. Must be between `0` and `1`. The closer
      to `1`, the more importance is going to be given to past observations. On the other hand,
      if its value approaches `0`, the recent observed errors are going to have more influence
      on the final decision.
  nominal_attributes
      List of Nominal attributes. If empty, then assume that all numeric attributes should
      be treated as continuous.
  splitter
      The Splitter or Attribute Observer (AO) used to monitor the class statistics of numeric
      features and perform splits. Splitters are available in the `tree.splitter` module.
      Different splitters are available for classification and regression tasks. Classification
      and regression splitters can be distinguished by their property `is_target_class`.
      This is an advanced option. Special care must be taken when choosing different splitters.
      By default, `tree.splitter.TEBSTSplitter` is used if `splitter` is `None`.
  min_samples_split
      The minimum number of samples every branch resulting from a split candidate must have
      to be considered valid.
  bootstrap_sampling
      If True, perform bootstrap sampling in the leaf nodes.
  drift_window_threshold
      Minimum number of examples an alternate tree must observe before being considered as a
      potential replacement to the current one.
  drift_detector
      The drift detector used to build the tree. If `None` then `drift.ADWIN` is used.
      Only detectors that support arbitrarily valued continuous data can be used for regression.
  switch_significance
      The significance level to assess whether alternate subtrees are significantly better
      than their main subtree counterparts.
  binary_split
      If True, only allow binary splits.
  max_size
      The max size of the tree, in Megabytes (MB).
  memory_estimate_period
      Interval (number of processed instances) between memory consumption checks.
  stop_mem_management
      If True, stop growing as soon as memory limit is hit.
  remove_poor_attrs
      If True, disable poor attributes to reduce memory usage.
  merit_preprune
      If True, enable merit-based tree pre-pruning.
  seed
     Random seed for reproducibility.
  
  Notes
  -----
  The Hoeffding Adaptive Tree [^1] uses drift detectors to monitor performance of branches
  in the tree and to replace them with new branches when their accuracy decreases.
  
  The bootstrap sampling strategy is an improvement over the original Hoeffding Adaptive Tree
  algorithm. It is enabled by default since, in general, it results in better performance.
  
  To cope with ADWIN's requirements of bounded input data, HATR uses a novel error normalization
  strategy based on the empiral rule of Gaussian distributions. We assume the deviations
  of the predictions from the expected values follow a normal distribution. Hence, we subject
  these errors to a min-max normalization assuming that most of the data lies in the
  $\left[-3\sigma, 3\sigma\right]$ range. These normalized errors are passed to the ADWIN
  instances. This is the same strategy used by Adaptive Random Forest Regressor.
  
  References
  ----------
  [^1]: Bifet, Albert, and Ricard Gavaldà. "Adaptive learning from evolving data streams."
  In International Symposium on Intelligent Data Analysis, pp. 249-260. Springer, Berlin,
  Heidelberg, 2009.
  
  Examples
  --------
  >>> from river import datasets
  >>> from river import evaluate
  >>> from river import metrics
  >>> from river import tree
  >>> from river import preprocessing
  
  >>> dataset = datasets.TrumpApproval()
  
  >>> model = (
  ...     preprocessing.StandardScaler() |
  ...     tree.HoeffdingAdaptiveTreeRegressor(
  ...         grace_period=50,
  ...         model_selector_decay=0.3,
  ...         seed=0
  ...     )
  ... )
  
  >>> metric = metrics.MAE()
  
  >>> evaluate.progressive_val_score(dataset, model, metric)
  MAE: 0.823026
docstr: Create a new split node.
docstr_tok: ["Create","a","new","split","node","."]
code: def _branch_selector(
      self, numerical_feature=True, multiway_split=False
  ) -> type[AdaBranchRegressor]:
      """Create a new split node."""
      if numerical_feature:
          if not multiway_split:
              return AdaNumBinaryBranchReg
          else:
              return AdaNumMultiwayBranchReg
      else:
          if not multiway_split:
              return AdaNomBinaryBranchReg
          else:
              return AdaNomMultiwayBranchReg
  
imports: from __future__ import annotations
  import random
  import statistics
  from copy import deepcopy
  from river import base, drift
  from .hoeffding_tree_regressor import HoeffdingTreeRegressor
  from .nodes.branch import DTBranch
  from .nodes.hatr_nodes import AdaBranchRegressor, AdaLeafRegAdaptive, AdaLeafRegMean, AdaLeafRegModel, AdaLeafRegressor, AdaNomBinaryBranchReg, AdaNomMultiwayBranchReg, AdaNumBinaryBranchReg, AdaNumMultiwayBranchReg
  from .splitter import Splitter
label_desc: Use image node_id 10 for calling the HoeffdingAdaptiveTreeRegressor obj's underlying member method code with example usage: obj._branch_selector(numerical_feature, multiway_split) and returns: AdaNumBinaryBranchReg, AdaNumMultiwayBranchReg, AdaNomBinaryBranchReg, AdaNomMultiwayBranchReg