code: def __init__(
      self,
      n_models: int,
      max_features: bool | str | int,
      resampling_strategy: str | None,
      resampling_rate: int | float,
      detection_mode: str,
      warning_detector: base.DriftDetector | None,
      drift_detector: base.DriftDetector | None,
      max_depth: int | None,
      randomize_tree_depth: bool,
      track_metric: metrics.base.MultiClassMetric
      | metrics.base.RegressionMetric,
      disable_weighted_vote: bool,
      split_buffer_size: int,
      seed: int | None,
  ):
      self.data = []
      self.n_models = n_models
      self.max_features = max_features
  
      if resampling_strategy not in [
          None,
          self._BAGGING,
          self._SUBBAGGING,
      ]:
          raise ValueError(
              f"Invalid resampling strategy: {resampling_strategy}"
          )
      self.resampling_strategy = resampling_strategy
  
      self.resampling_rate: int | float = 0
      if self.resampling_strategy is not None:
          if self.resampling_strategy == self._BAGGING:
              if resampling_rate < 1:
                  raise ValueError(
                      "'resampling_rate' must be an integer greater than or"
                      "equal to 1, when resample_strategy='bagging'."
                  )
              # Cast to integer (online bagging using poisson sampling)
              self.resampling_rate = int(resampling_rate)
  
          if self.resampling_strategy == self._SUBBAGGING:
              if not 0 < resampling_rate <= 1:
                  raise ValueError(
                      "resampling_rate must be a float in the interval (0, 1],"
                      "when resampling_strategy='subbagging'."
                  )
              self.resampling_rate = resampling_rate
  
      if detection_mode not in [
          self._DETECTION_ALL,
          self._DETECTION_DROP,
          self._DETECTION_OFF,
      ]:
          raise ValueError(
              f"Invalid drift detection mode. Valid values are: '{self._DETECTION_ALL}',"
              f" {self._DETECTION_DROP}, and '{self._DETECTION_OFF}'."
          )
  
      self.detection_mode = detection_mode
      self.warning_detector = warning_detector or drift.ADWIN(
          delta=0.01
      )
      self.drift_detector = drift_detector or drift.ADWIN(delta=0.001)
  
      self.max_depth = max_depth
      self.randomize_tree_depth = randomize_tree_depth
      self.track_metric = track_metric
      self.disable_weighted_vote = disable_weighted_vote
      self.split_buffer_size = split_buffer_size
      self.seed = seed
  
      # The predictive performance of each tree
      self._perfs: list = []
      # Keep a running estimate of the sum of performances
      self._perf_sum: float = 0
  
      # Number of times a tree will use each instance to learn from it
      self._weight_sampler = self.__weight_sampler_factory()
  
      # General statistics
      # Counter of the number of instances each ensemble member has processed (instance weights
      # are not accounted for, just the number of instances)
      self._sample_counter: collections.Counter = collections.Counter()
      # Total of samples processed by the Extra Trees ensemble
      self._total_instances: float = 0
      # Number of warnings triggered
      self._n_warnings: collections.Counter = collections.Counter()
      # Number of drifts detected
      self._n_drifts: collections.Counter = collections.Counter()
      # Number of tree swaps
      self._n_tree_swaps: collections.Counter = collections.Counter()
  
      self._background_trees: dict[
          int, tree.hoeffding_tree.HoeffdingTree
      ] = {}
      # Initialize drift detectors and select the detection mode procedure
      if self.detection_mode == self._DETECTION_ALL:
          self._warn_detectors = {
              i: self.warning_detector.clone()
              for i in range(self.n_models)
          }
          self._drift_detectors = {
              i: self.drift_detector.clone()
              for i in range(self.n_models)
          }
      elif self.detection_mode == self._DETECTION_DROP:
          self._warn_detectors = {}
          self._drift_detectors = {
              i: self.drift_detector.clone()
              for i in range(self.n_models)
          }
      else:  # detection_mode: "off"
          self._warn_detectors = {}
          self._drift_detectors = {}
      self._detect = self.__detection_mode_factory()
  
      # Set the rng
      self._rng = random.Random(seed)
  
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 1 to create a new ExtraTrees object from inherited base classes: base with example: obj = ExtraTrees(n_models, max_features, resampling_strategy, resampling_rate, detection_mode, warning_detector, drift_detector, max_depth, randomize_tree_depth, track_metric, disable_weighted_vote, split_buffer_size, seed)