class_docstr: Mondrian Tree Regressor.
  
  Parameters
  ----------
  step
      Step of the tree.
  use_aggregation
      Whether to use aggregation weighting techniques or not.
  iteration
      Number iterations to do during training.
  seed
      Random seed for reproducibility.
  
  Notes
  -----
  The Mondrian Tree Regressor is a type of decision tree that bases splitting decisions over a
  Mondrian process.
  
  References
  ----------
  [^1]: Balaji Lakshminarayanan, Daniel M. Roy, Yee Whye Teh. Mondrian Forests: Efficient Online Random Forests.
      arXiv:1406.2673, pages 2-4.
class_docstr_tok: ["Mondrian","Tree","Regressor",".","Parameters","--","--","--","--","--","step","Step","of","the","tree",".","use_aggregation","Whether","to","use","aggregation","weighting","techniques","or","not",".","iteration","Number","iterations","to","do","during","training",".","seed","Random","seed","for","reproducibility",".","Notes","--","--","-","The","Mondrian","Tree","Regressor","is","a","type","of","decision","tree","that","bases","splitting","decisions","over","a","Mondrian","process",".","References","--","--","--","--","--","[","^1","]",":","Balaji","Lakshminarayanan",",","Daniel","M.","Roy",",","Yee","Whye","Teh",".","Mondrian","Forests",":","Efficient","Online","Random","Forests",".","arXiv:1406.2673",",","pages","2-4","."]
docstr: Predict the label of the samples.
  
  Parameters
  ----------
  x
      Feature vector.
docstr_tok: ["Predict","the","label","of","the","samples",".","Parameters","--","--","--","--","--","x","Feature","vector","."]
code: def predict_one(self, x):
      """Predict the label of the samples.
  
      Parameters
      ----------
      x
          Feature vector.
  
      """
  
      # If the tree hasn't seen any sample, then it should return
      # the default empty dict
      if not self._is_initialized:
          return
  
      leaf = (
          self._root.traverse(x, until_leaf=True)
          if isinstance(self._root, MondrianBranchRegressor)
          else self._root
      )
  
      if not self.use_aggregation:
          return self._predict(leaf)
  
      current = leaf
      prediction = 0.0
  
      while True:
          # This test is useless ?
          if isinstance(current, MondrianLeafRegressor):
              prediction = self._predict(current)
          else:
              weight = current.weight
              log_weight_tree = current.log_weight_tree
              w = math.exp(weight - log_weight_tree)
              # Get the predictions of the current node
              pred_new = self._predict(current)
              prediction = (
                  0.5 * w * pred_new + (1 - 0.5 * w) * prediction
              )
  
          # Root must be updated as well
          if current.parent is None:
              break
  
          # And now we go up
          current = current.parent
  
      return prediction
  
file_path: river/river/tree/mondrian/mondrian_tree_regressor.py
imports: from __future__ import annotations
  import math
  from river import base, utils
  from river.tree.mondrian.mondrian_tree import MondrianTree
  from river.tree.mondrian.mondrian_tree_nodes import MondrianBranchRegressor, MondrianLeafRegressor, MondrianNodeRegressor
label_desc: Use image node_id 12 for calling the MondrianTreeRegressor obj's underlying member method code with example usage: obj.predict_one(x) and returns: prediction, self