class_docstr: Representation of a node within a Mondrian tree
docstr: Compute the range extension of the node for the given sample.
  
  Parameters
  ----------
  x
      Sample to deal with.
docstr_tok: ["Compute","the","range","extension","of","the","node","for","the","given","sample",".","Parameters","--","--","--","--","--","x","Sample","to","deal","with","."]
code: def range_extension(
      self, x
  ) -> tuple[float, dict[base.typing.ClfTarget, float]]:
      """Compute the range extension of the node for the given sample.
  
      Parameters
      ----------
      x
          Sample to deal with.
  
      """
  
      extensions: dict[base.typing.ClfTarget, float] = {}
      extensions_sum = 0.0
      for feature in x:
          x_f = x[feature]
          feature_min_j, feature_max_j = self.range(feature)
          if x_f < feature_min_j:
              diff = feature_min_j - x_f
          elif x_f > feature_max_j:
              diff = x_f - feature_max_j
          else:
              diff = 0
          extensions[feature] = diff
          extensions_sum += diff
      return extensions_sum, extensions
  
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 MondrianNode obj's underlying member method code with example usage: obj.range_extension(x) and returns: extensions_sum,  extensions