code: def unwind_path(
      feature_indexes,
      zero_fractions,
      one_fractions,
      pweights,
      unique_depth,
      path_index,
  ):
      one_fraction = one_fractions[path_index]
      zero_fraction = zero_fractions[path_index]
      next_one_portion = pweights[unique_depth]
  
      for i in range(unique_depth - 1, -1, -1):
          if one_fraction != 0.0:
              tmp = pweights[i]
              pweights[i] = (
                  next_one_portion
                  * (unique_depth + 1.0)
                  / ((i + 1.0) * one_fraction)
              )
              next_one_portion = tmp - pweights[i] * zero_fraction * (
                  unique_depth - i
              ) / (unique_depth + 1.0)
          else:
              pweights[i] = (pweights[i] * (unique_depth + 1)) / (
                  zero_fraction * (unique_depth - i)
              )
  
      for i in range(path_index, unique_depth):
          feature_indexes[i] = feature_indexes[i + 1]
          zero_fractions[i] = zero_fractions[i + 1]
          one_fractions[i] = one_fractions[i + 1]
  
file_path: shap/shap/explainers/pytree.py
imports: import numpy
  import pandas
  from ..utils._exceptions import ExplainerError
label_desc: Use image node_id 2 for calling a global function with example usage: unwind_path(feature_indexes, zero_fractions, one_fractions, pweights, unique_depth, path_index) without return types