class_docstr: Online Extra Trees regressor.
  
  The online Extra Trees[^1] ensemble takes some steps further into randomization when
  compared to Adaptive Random Forests (ARF). A subspace of the feature space is considered
  at each split attempt, as ARF does, and online bagging or subbagging can also be
  (optionally) used. Nonetheless, Extra Trees randomizes the split candidates evaluated by each
  leaf node (just a single split is tested by numerical feature, which brings significant
  speedups to the ensemble), and might also randomize the maximum depth of the forest members,
  as well as the size of the feature subspace processed by each of its trees' leaves.
  
  On the other hand, OXT suffers from a cold-start problem. As the splits are random, the
  predictive performance in small samples is usually worse than using a deterministic
  split approach, such as the one used by ARF.
  
  Parameters
  ----------
  n_models
      The number of trees in the ensemble.
  max_features
      Max number of attributes for each node split.</br>
      - If int, then consider `max_features` at each split.</br>
      - If float, then `max_features` is a percentage and `int(max_features * n_features)`
      features are considered per split.</br>
      - If "sqrt", then `max_features=sqrt(n_features)`.</br>
      - If "log2", then `max_features=log2(n_features)`.</br>
      - If "random", then `max_features` will assume a different random number in the interval
      `[2, n_features]` for each tree leaf.</br>
      - If None, then `max_features=n_features`.
  resampling_strategy
      The chosen instance resampling strategy:</br>
      - If `None`, no resampling will be done and the trees will process all instances.
      - If `'baggging'`, online bagging will be performed (sampling with replacement).
      - If `'subbagging'`, online subbagging will be performed (sampling without replacement).
  resampling_rate
      Only valid if `resampling_strategy` is not None. Controls the parameters of the resampling
      strategy.</br>.
      - If `resampling_strategy='bagging'`, must be an integer greater than or equal to 1 that
      parameterizes the poisson distribution used to simulate bagging in online learning
      settings. It acts as the lambda parameter of Oza Bagging and Leveraging Bagging.</br>
      - If `resampling_strategy='subbagging'`, must be a float in the interval $(0, 1]$ that
      controls the chance of each instance being used by a tree for learning.
  detection_mode
      The concept drift detection mode in which the forest operates. Valid values are:</br>
      - "all": creates both warning and concept drift detectors. If a warning is detected,
      an alternate tree starts being trained in the background. If the warning trigger escalates
      to a concept drift, the affected tree is replaced by the alternate tree.</br>
      - "drop": only the concept drift detectors are created. If a drift is detected, the
      affected tree is dropped and replaced by a new tree.</br>
      - "off": disables the concept drift adaptation capabilities. The forest will act as if
      the processed stream is stationary.
  warning_detector
      The detector that will be used to trigger concept drift warnings. Defaults to
      `drift.ADWIN(0.01)`.
  drift_detector
      The detector used to detect concept drifts. Defaults to `drift.ADWIN(0.001)`.
  max_depth
      The maximum depth the ensemble members might reach. If `None`, the trees will grow
      indefinitely.
  randomize_tree_depth
      Whether or not randomize the maximum depth of each tree in the ensemble. If `max_depth`
      is provided, it is going to act as an upper bound to generate the maximum depth for each
      tree.
  track_metric
      The performance metric used to weight predictions. Defaults to `metrics.MAE()`.
  disable_weighted_vote
      Defines whether or not to use predictions weighted by each trees' prediction performance.
  split_buffer_size
      Defines the size of the buffer used by the tree splitters when determining the feature
      range and a random split point in this interval.
  seed
      Random seed to support reproducibility.
  grace_period
      [*Tree parameter*] Number of instances a leaf should observe between
      split attempts.
  delta
      [*Tree parameter*] Allowed error in split decision, a value closer to 0
      takes longer to decide.
  tau
      [*Tree parameter*] Threshold below which a split will be forced to break
      ties.
  leaf_prediction
      [*Tree parameter*] Prediction mechanism used at leaves.</br>
      - 'mean' - Target mean</br>
      - 'model' - Uses the model defined in `leaf_model`</br>
      - 'adaptive' - Chooses between 'mean' and 'model' dynamically</br>
  leaf_model
      [*Tree parameter*] 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
      [*Tree parameter*] 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
      [*Tree parameter*] List of Nominal attributes. If empty, then assume that
      all attributes are numerical.
  min_samples_split
      [*Tree parameter*] The minimum number of samples every branch resulting from a split
      candidate must have to be considered valid.
  binary_split
      [*Tree parameter*] If True, only allow binary splits.
  max_size
      [*Tree parameter*] Maximum memory (MB) consumed by the tree.
  memory_estimate_period
      [*Tree parameter*] Number of instances between memory consumption checks.
  stop_mem_management
      [*Tree parameter*] If True, stop growing as soon as memory limit is hit.
  remove_poor_attrs
      [*Tree parameter*] If True, disable poor attributes to reduce memory usage.
  merit_preprune
      [*Tree parameter*] If True, enable merit-based tree pre-pruning.
  
  Notes
  -----
  As the Online Extra Trees change the way in which Hoeffding Trees perform split attempts
  and monitor numerical input features, some of the parameters of the vanilla Hoeffding Tree
  algorithms are not available.
  
  Examples
  --------
  
  >>> from river import datasets
  >>> from river import evaluate
  >>> from river import metrics
  >>> from river import forest
  
  >>> dataset = datasets.synth.Friedman(seed=42).take(5000)
  
  >>> model = forest.OXTRegressor(n_models=3, seed=42)
  
  >>> metric = metrics.RMSE()
  
  >>> evaluate.progressive_val_score(dataset, model, metric)
  RMSE: 3.127311
  
  References
  ----------
  [^1]: Mastelini, S. M., Nakano, F. K., Vens, C., & de Leon Ferreira, A. C. P. (2022).
  Online Extra Trees Regressor. IEEE Transactions on Neural Networks and Learning Systems.
class_docstr_tok: ["Online","Extra","Trees","regressor",".","The","online","Extra","Trees","[","^1","]","ensemble","takes","some","steps","further","into","randomization","when","compared","to","Adaptive","Random","Forests","(","ARF",")",".","A","subspace","of","the","feature","space","is","considered","at","each","split","attempt",",","as","ARF","does",",","and","online","bagging","or","subbagging","can","also","be","(","optionally",")","used",".","Nonetheless",",","Extra","Trees","randomizes","the","split","candidates","evaluated","by","each","leaf","node","(","just","a","single","split","is","tested","by","numerical","feature",",","which","brings","significant","speedups","to","the","ensemble",")",",","and","might","also","randomize","the","maximum","depth","of","the","forest","members",",","as","well","as","the","size","of","the","feature","subspace","processed","by","each","of","its","trees","'","leaves",".","On","the","other","hand",",","OXT","suffers","from","a","cold-start","problem",".","As","the","splits","are","random",",","the","predictive","performance","in","small","samples","is","usually","worse","than","using","a","deterministic","split","approach",",","such","as","the","one","used","by","ARF",".","Parameters","--","--","--","--","--","n_models","The","number","of","trees","in","the","ensemble",".","max_features","Max","number","of","attributes","for","each","node","split.","<","\/br",">","-","If","int",",","then","consider","`","max_features","`","at","each","split.","<","\/br",">","-","If","float",",","then","`","max_features","`","is","a","percentage","and","`","int","(","max_features","*","n_features",")","`","features","are","considered","per","split.","<","\/br",">","-","If","``","sqrt","''",",","then","`","max_features=sqrt","(","n_features",")","`",".","<","\/br",">","-","If","``","log2","''",",","then","`","max_features=log2","(","n_features",")","`",".","<","\/br",">","-","If","``","random","''",",","then","`","max_features","`","will","assume","a","different","random","number","in","the","interval","`","[","2",",","n_features","]","`","for","each","tree","leaf.","<","\/br",">","-","If","None",",","then","`","max_features=n_features","`",".","resampling_strategy","The","chosen","instance","resampling","strategy",":","<","\/br",">","-","If","`","None","`",",","no","resampling","will","be","done","and","the","trees","will","process","all","instances",".","-","If","`","'baggging","'","`",",","online","bagging","will","be","performed","(","sampling","with","replacement",")",".","-","If","`","'subbagging","'","`",",","online","subbagging","will","be","performed","(","sampling","without","replacement",")",".","resampling_rate","Only","valid","if","`","resampling_strategy","`","is","not","None",".","Controls","the","parameters","of","the","resampling","strategy.","<","\/br",">",".","-","If","`","resampling_strategy='bagging","'","`",",","must","be","an","integer","greater","than","or","equal","to","1","that","parameterizes","the","poisson","distribution","used","to","simulate","bagging","in","online","learning","settings",".","It","acts","as","the","lambda","parameter","of","Oza","Bagging","and","Leveraging","Bagging.","<","\/br",">","-","If","`","resampling_strategy='subbagging","'","`",",","must","be","a","float","in","the","interval","$","(","0",",","1","]","$","that","controls","the","chance","of","each","instance","being","used","by","a","tree","for","learning",".","detection_mode","The","concept","drift","detection","mode","in","which","the","forest","operates",".","Valid","values","are",":","<","\/br",">","-","``","all","''",":","creates","both","warning","and","concept","drift","detectors",".","If","a","warning","is","detected",",","an","alternate","tree","starts","being","trained","in","the","background",".","If","the","warning","trigger","escalates","to","a","concept","drift",",","the","affected","tree","is","replaced","by","the","alternate","tree.","<","\/br",">","-","``","drop","''",":","only","the","concept","drift","detectors","are","created",".","If","a","drift","is","detected",",","the","affected","tree","is","dropped","and","replaced","by","a","new","tree.","<","\/br",">","-","``","off","''",":","disables","the","concept","drift","adaptation","capabilities",".","The","forest","will","act","as","if","the","processed","stream","is","stationary",".","warning_detector","The","detector","that","will","be","used","to","trigger","concept","drift","warnings",".","Defaults","to","`","drift.ADWIN","(","0.01",")","`",".","drift_detector","The","detector","used","to","detect","concept","drifts",".","Defaults","to","`","drift.ADWIN","(","0.001",")","`",".","max_depth","The","maximum","depth","the","ensemble","members","might","reach",".","If","`","None","`",",","the","trees","will","grow","indefinitely",".","randomize_tree_depth","Whether","or","not","randomize","the","maximum","depth","of","each","tree","in","the","ensemble",".","If","`","max_depth","`","is","provided",",","it","is","going","to","act","as","an","upper","bound","to","generate","the","maximum","depth","for","each","tree",".","track_metric","The","performance","metric","used","to","weight","predictions",".","Defaults","to","`","metrics.MAE","(",")","`",".","disable_weighted_vote","Defines","whether","or","not","to","use","predictions","weighted","by","each","trees","'","prediction","performance",".","split_buffer_size","Defines","the","size","of","the","buffer","used","by","the","tree","splitters","when","determining","the","feature","range","and","a","random","split","point","in","this","interval",".","seed","Random","seed","to","support","reproducibility",".","grace_period","[","*","Tree","parameter","*","]","Number","of","instances","a","leaf","should","observe","between","split","attempts",".","delta","[","*","Tree","parameter","*","]","Allowed","error","in","split","decision",",","a","value","closer","to","0","takes","longer","to","decide",".","tau","[","*","Tree","parameter","*","]","Threshold","below","which","a","split","will","be","forced","to","break","ties",".","leaf_prediction","[","*","Tree","parameter","*","]","Prediction","mechanism","used","at","leaves.","<","\/br",">","-","'mean","'","-","Target","mean","<","\/br",">","-","'model","'","-","Uses","the","model","defined","in","`","leaf_model","`","<","\/br",">","-","'adaptive","'","-","Chooses","between","'mean","'","and","'model","'","dynamically","<","\/br",">","leaf_model","[","*","Tree","parameter","*","]","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","[","*","Tree","parameter","*","]","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","[","*","Tree","parameter","*","]","List","of","Nominal","attributes",".","If","empty",",","then","assume","that","all","attributes","are","numerical",".","min_samples_split","[","*","Tree","parameter","*","]","The","minimum","number","of","samples","every","branch","resulting","from","a","split","candidate","must","have","to","be","considered","valid",".","binary_split","[","*","Tree","parameter","*","]","If","True",",","only","allow","binary","splits",".","max_size","[","*","Tree","parameter","*","]","Maximum","memory","(","MB",")","consumed","by","the","tree",".","memory_estimate_period","[","*","Tree","parameter","*","]","Number","of","instances","between","memory","consumption","checks",".","stop_mem_management","[","*","Tree","parameter","*","]","If","True",",","stop","growing","as","soon","as","memory","limit","is","hit",".","remove_poor_attrs","[","*","Tree","parameter","*","]","If","True",",","disable","poor","attributes","to","reduce","memory","usage",".","merit_preprune","[","*","Tree","parameter","*","]","If","True",",","enable","merit-based","tree","pre-pruning",".","Notes","--","--","-","As","the","Online","Extra","Trees","change","the","way","in","which","Hoeffding","Trees","perform","split","attempts","and","monitor","numerical","input","features",",","some","of","the","parameters","of","the","vanilla","Hoeffding","Tree","algorithms","are","not","available",".","Examples","--","--","--","--",">",">",">","from","river","import","datasets",">",">",">","from","river","import","evaluate",">",">",">","from","river","import","metrics",">",">",">","from","river","import","forest",">",">",">","dataset","=","datasets.synth.Friedman","(","seed=42",")",".take","(","5000",")",">",">",">","model","=","forest.OXTRegressor","(","n_models=3",",","seed=42",")",">",">",">","metric","=","metrics.RMSE","(",")",">",">",">","evaluate.progressive_val_score","(","dataset",",","model",",","metric",")","RMSE",":","3.127311","References","--","--","--","--","--","[","^1","]",":","Mastelini",",","S.","M.",",","Nakano",",","F.","K.",",","Vens",",","C.",",","&","de","Leon","Ferreira",",","A.","C.","P.","(","2022",")",".","Online","Extra","Trees","Regressor",".","IEEE","Transactions","on","Neural","Networks","and","Learning","Systems","."]
code: def predict_one(self, x: dict) -> base.typing.RegTarget:
      if not self.models:
          self._init_trees(len(x))
          return 0.0  # type: ignore
  
      if not self.disable_weighted_vote:
          preds = []
          weights = []
  
          for perf, model in zip(self._perfs, self.models):
              preds.append(model.predict_one(x))
              weights.append(perf.get())
  
          sum_weights = sum(weights)
          if sum_weights != 0:
              if self.track_metric.bigger_is_better:
                  preds = [
                      (w / sum_weights) * pred
                      for w, pred in zip(weights, preds)
                  ]
              else:
                  weights = [(1 + 1e-8) / (w + 1e-8) for w in weights]
                  sum_weights = sum(weights)
                  preds = [
                      (w / sum_weights) * pred
                      for w, pred in zip(weights, preds)
                  ]
              return sum(preds)
      else:
          preds = [model.predict_one(x) for model in self.models]
  
      return sum(preds) / len(preds)
  
imports: from __future__ import annotations
  import abc
  import collections
  import math
  import random
  import sys
  from river import base, drift, metrics, tree, utils
  from river.tree.nodes.et_nodes import ETLeafAdaptive, ETLeafMean, ETLeafModel
  from river.tree.splitter.random_splitter import RegRandomSplitter
label_desc: Use image node_id 4 for calling the OXTRegressor obj's underlying member method code with example usage: obj.predict_one(x) and returns: unknown, int, sum