class_docstr: ADWIN Bagging classifier.
  
  ADWIN Bagging [^1] is the online bagging method of Oza and Russell [^2]
  with the addition of the `ADWIN` algorithm as a change detector. If concept
  drift is detected, the worst member of the ensemble (based on the error
  estimation by ADWIN) is replaced by a new (empty) classifier.
  
  Parameters
  ----------
  model
      The classifier to bag.
  n_models
      The number of models in the ensemble.
  seed
      Random number generator seed for reproducibility.
  
  Examples
  --------
  >>> from river import datasets
  >>> from river import ensemble
  >>> from river import evaluate
  >>> from river import linear_model
  >>> from river import metrics
  >>> from river import optim
  >>> from river import preprocessing
  
  >>> dataset = datasets.Phishing()
  
  >>> model = ensemble.ADWINBaggingClassifier(
  ...     model=(
  ...         preprocessing.StandardScaler() |
  ...         linear_model.LogisticRegression()
  ...     ),
  ...     n_models=3,
  ...     seed=42
  ... )
  
  >>> metric = metrics.F1()
  
  >>> evaluate.progressive_val_score(dataset, model, metric)
  F1: 87.65%
  
  References
  ----------
  [^1]: Albert Bifet, Geoff Holmes, Bernhard Pfahringer, Richard Kirkby,
  and Ricard Gavaldà. "New ensemble methods for evolving data streams."
  In 15th ACM SIGKDD International Conference on Knowledge Discovery and
  Data Mining, 2009.
  
  [^2]: Oza, N., Russell, S. "Online bagging and boosting."
  In: Artificial Intelligence and Statistics 2001, pp. 105–112.
  Morgan Kaufmann, 2001.
class_docstr_tok: ["ADWIN","Bagging","classifier",".","ADWIN","Bagging","[","^1","]","is","the","online","bagging","method","of","Oza","and","Russell","[","^2","]","with","the","addition","of","the","`","ADWIN","`","algorithm","as","a","change","detector",".","If","concept","drift","is","detected",",","the","worst","member","of","the","ensemble","(","based","on","the","error","estimation","by","ADWIN",")","is","replaced","by","a","new","(","empty",")","classifier",".","Parameters","--","--","--","--","--","model","The","classifier","to","bag",".","n_models","The","number","of","models","in","the","ensemble",".","seed","Random","number","generator","seed","for","reproducibility",".","Examples","--","--","--","--",">",">",">","from","river","import","datasets",">",">",">","from","river","import","ensemble",">",">",">","from","river","import","evaluate",">",">",">","from","river","import","linear_model",">",">",">","from","river","import","metrics",">",">",">","from","river","import","optim",">",">",">","from","river","import","preprocessing",">",">",">","dataset","=","datasets.Phishing","(",")",">",">",">","model","=","ensemble.ADWINBaggingClassifier","(","...","model=","(","...","preprocessing.StandardScaler","(",")","|","...","linear_model.LogisticRegression","(",")","...",")",",","...","n_models=3",",","...","seed=42","...",")",">",">",">","metric","=","metrics.F1","(",")",">",">",">","evaluate.progressive_val_score","(","dataset",",","model",",","metric",")","F1",":","87.65","%","References","--","--","--","--","--","[","^1","]",":","Albert","Bifet",",","Geoff","Holmes",",","Bernhard","Pfahringer",",","Richard","Kirkby",",","and","Ricard","Gavald\u00e0",".","``","New","ensemble","methods","for","evolving","data","streams",".","''","In","15th","ACM","SIGKDD","International","Conference","on","Knowledge","Discovery","and","Data","Mining",",","2009",".","[","^2","]",":","Oza",",","N.",",","Russell",",","S.","``","Online","bagging","and","boosting",".","''","In",":","Artificial","Intelligence","and","Statistics","2001",",","pp",".","105\u2013112",".","Morgan","Kaufmann",",","2001","."]
code: def learn_one(self, x, y, **kwargs):
      change_detected = False
      for i, model in enumerate(self):
          for _ in range(utils.random.poisson(1, self._rng)):
              model.learn_one(x, y, **kwargs)
  
          y_pred = model.predict_one(x)
          error_estimation = self._drift_detectors[i].estimation
          self._drift_detectors[i].update(int(y_pred == y))
          if self._drift_detectors[i].drift_detected:
              if self._drift_detectors[i].estimation > error_estimation:
                  change_detected = True
  
      if change_detected:
          max_error_idx = max(
              range(len(self._drift_detectors)),
              key=lambda j: self._drift_detectors[j].estimation,
          )
          self.models[max_error_idx] = self.model.clone()
          self._drift_detectors[max_error_idx] = drift.ADWIN()
  
imports: from __future__ import annotations
  import collections
  import statistics
  from river import base, drift, linear_model, utils
label_desc: Use image node_id 2 for calling the ADWINBaggingClassifier obj's underlying member method code with example usage: obj.learn_one(x, y) without return types