docstr: Update the weight of the node given a label and the method used.
  
  Parameters
  ----------
  sample_value
      Label of a given sample.
  use_aggregation
      Whether to use aggregation or not during computation (given by the tree).
  step
      Step parameter of the tree.
docstr_tok: ["Update","the","weight","of","the","node","given","a","label","and","the","method","used",".","Parameters","--","--","--","--","--","sample_value","Label","of","a","given","sample",".","use_aggregation","Whether","to","use","aggregation","or","not","during","computation","(","given","by","the","tree",")",".","step","Step","parameter","of","the","tree","."]
code: def update_weight(
      self,
      sample_value: base.typing.RegTarget,
      use_aggregation: bool,
      step: float,
  ) -> float:
      """Update the weight of the node given a label and the method used.
  
      Parameters
      ----------
      sample_value
          Label of a given sample.
      use_aggregation
          Whether to use aggregation or not during computation (given by the tree).
      step
          Step parameter of the tree.
  
      """
  
      loss_t = self.loss(sample_value)
      if use_aggregation:
          self.weight -= step * loss_t
      return loss_t
  
imports: from __future__ import annotations
  import collections
  import math
  from river import base, stats
  from river.tree.base import Branch, Leaf
  from river.utils.math import log_sum_2_exp
label_desc: Use image node_id 5 for calling the MondrianNodeRegressor obj's underlying member method code with example usage: obj.update_weight(sample_value, use_aggregation, step) and returns: loss_t