class_docstr: Aggregated Mondrian Forest regressor for online learning.
  
  This algorithm is truly online, in the sense that a single pass is performed, and that
  predictions can be produced anytime.
  
  Each node in a tree predicts according to the average of the labels it contains.
  The prediction for a sample is computed as the aggregated predictions of all the subtrees
  along the path leading to the leaf node containing the sample. The aggregation weights are
  exponential weights with learning rate `step` using a squared loss when `use_aggregation`
  is `True`.
  
  This computation is performed exactly thanks to a context tree weighting algorithm.
  More details can be found in the original paper[^1].
  
  The final predictions are the average of the predictions of each of the
  ``n_estimators`` trees in the forest.
  
  Parameters
  ----------
  n_estimators
      The number of trees in the forest.
  step
      Step-size for the aggregation weights.
  use_aggregation
      Controls if aggregation is used in the trees. It is highly recommended to
      leave it as `True`.
  seed
      Random seed for reproducibility.
  
  Examples
  --------
  
  >>> from river import datasets
  >>> from river import evaluate
  >>> from river import forest
  >>> from river import metrics
  
  >>> dataset = datasets.TrumpApproval()
  >>> model = forest.AMFRegressor(seed=42)
  >>> metric = metrics.MAE()
  
  >>> evaluate.progressive_val_score(dataset, model, metric)
  MAE: 0.268533
  
  References
  ----------
  [^1]: Mourtada, J., Gaïffas, S., & Scornet, E. (2021). AMF: Aggregated Mondrian forests for online
  learning. Journal of the Royal Statistical Society Series B: Statistical Methodology, 83(3), 505-533.
class_docstr_tok: ["Aggregated","Mondrian","Forest","regressor","for","online","learning",".","This","algorithm","is","truly","online",",","in","the","sense","that","a","single","pass","is","performed",",","and","that","predictions","can","be","produced","anytime",".","Each","node","in","a","tree","predicts","according","to","the","average","of","the","labels","it","contains",".","The","prediction","for","a","sample","is","computed","as","the","aggregated","predictions","of","all","the","subtrees","along","the","path","leading","to","the","leaf","node","containing","the","sample",".","The","aggregation","weights","are","exponential","weights","with","learning","rate","`","step","`","using","a","squared","loss","when","`","use_aggregation","`","is","`","True","`",".","This","computation","is","performed","exactly","thanks","to","a","context","tree","weighting","algorithm",".","More","details","can","be","found","in","the","original","paper","[","^1","]",".","The","final","predictions","are","the","average","of","the","predictions","of","each","of","the","``","n_estimators","``","trees","in","the","forest",".","Parameters","--","--","--","--","--","n_estimators","The","number","of","trees","in","the","forest",".","step","Step-size","for","the","aggregation","weights",".","use_aggregation","Controls","if","aggregation","is","used","in","the","trees",".","It","is","highly","recommended","to","leave","it","as","`","True","`",".","seed","Random","seed","for","reproducibility",".","Examples","--","--","--","--",">",">",">","from","river","import","datasets",">",">",">","from","river","import","evaluate",">",">",">","from","river","import","forest",">",">",">","from","river","import","metrics",">",">",">","dataset","=","datasets.TrumpApproval","(",")",">",">",">","model","=","forest.AMFRegressor","(","seed=42",")",">",">",">","metric","=","metrics.MAE","(",")",">",">",">","evaluate.progressive_val_score","(","dataset",",","model",",","metric",")","MAE",":","0.268533","References","--","--","--","--","--","[","^1","]",":","Mourtada",",","J.",",","Ga\u00efffas",",","S.",",","&","Scornet",",","E.","(","2021",")",".","AMF",":","Aggregated","Mondrian","forests","for","online","learning",".","Journal","of","the","Royal","Statistical","Society","Series","B",":","Statistical","Methodology",",","83","(","3",")",",","505-533","."]
code: def predict_one(self, x):
      # Checking that the model has been trained once at least
      if not self._is_initialized:
          return None
  
      prediction = 0
      for tree in self:
          tree.use_aggregation = self.use_aggregation
          prediction += tree.predict_one(x)
      prediction = prediction / self.n_estimators
  
      return prediction
  
imports: from __future__ import annotations
  import abc
  import random
  from river import base
  from river.tree.mondrian import MondrianTreeClassifier, MondrianTreeRegressor
label_desc: Use image node_id 4 for calling the AMFRegressor obj's underlying member method code with example usage: obj.predict_one(x) and returns: prediction, None