code: def compute_expectations(
      children_left,
      children_right,
      node_sample_weight,
      values,
      i,
      depth=0,
  ):
      if children_right[i] == -1:
          values[i, :] = values[i, :]
          return 0
      else:
          li = children_left[i]
          ri = children_right[i]
          depth_left = compute_expectations(
              children_left,
              children_right,
              node_sample_weight,
              values,
              li,
              depth + 1,
          )
          depth_right = compute_expectations(
              children_left,
              children_right,
              node_sample_weight,
              values,
              ri,
              depth + 1,
          )
          left_weight = node_sample_weight[li]
          right_weight = node_sample_weight[ri]
          v = (
              left_weight * values[li, :] + right_weight * values[ri, :]
          ) / (left_weight + right_weight)
          values[i, :] = v
          return max(depth_left, depth_right) + 1
  
file_path: shap/shap/explainers/pytree.py
imports: import numpy
  import pandas
  from ..utils._exceptions import ExplainerError
label_desc: Use image node_id 4 for calling a global function with example usage: compute_expectations(children_left, children_right, node_sample_weight, values, i, depth) and returns: int, unknown