code: def calculate_contributions_along_path(
      explainer,
      new_observation,
      feature_path,
      baseline_yhat,
      target_yhat,
      type,
      keep_distributions,
  ):
      open_variables = set(np.arange(explainer.data.shape[1]))
      current_data = deepcopy(explainer.data)
      step = 0
      yhats = []
      yhats_mean = []
      selected_rows = []
  
      for i in range(feature_path.shape[0]):
          candidates = [feature_path["ind1"].iloc[i]]
          if type == "2d":
              ind2_is_None = feature_path["ind2"].iloc[i] is None
              candidates.append(
                  feature_path["ind2"].iloc[i]
              ) if not ind2_is_None else None
          else:
              ind2_is_None = True
  
          if open_variables.issuperset(candidates):
              # we can add this effect to out path
              for candidate in candidates:
                  current_data.iloc[
                      :, candidate
                  ] = new_observation.iloc[0, candidate]
  
              step += 1
  
              yhats_pred = explainer.predict(current_data)
  
              if keep_distributions:
                  yhats.append(
                      pd.DataFrame(
                          {
                              "variable_name": ":".join(
                                  explainer.data.columns[candidates]
                              ),
                              "variable": ":".join(
                                  explainer.data.columns[candidates]
                              )
                              + "="
                              + nice_pair(
                                  new_observation,
                                  candidates[0],
                                  None
                                  if ind2_is_None
                                  else candidates[1],
                              ),
                              "id": np.arange(explainer.data.shape[0]),
                              "prediction": yhats_pred,
                              "label": explainer.label,
                          }
                      )
                  )
  
              yhats_mean.append(np.mean(yhats_pred))
              selected_rows.append(i)
              open_variables = open_variables.difference(candidates)
  
      selected = feature_path.iloc[selected_rows, :]
  
      # extract values
      selected_values = selected.apply(
          lambda row: nice_pair(
              new_observation,
              row["ind1"],
              None if type == "1d" else row["ind2"],
          ),
          axis=1,
      )
  
      # prepare values
      yhats = pd.concat(yhats) if keep_distributions else None
  
      cumulative = np.hstack((baseline_yhat, yhats_mean, target_yhat))
      contribution = np.hstack((cumulative[0], np.diff(cumulative)))
      contribution[-1] = cumulative[-1]
  
      result = {
          "variable_name": np.hstack(("intercept", selected.index, "")),
          "variable_value": np.hstack(("", selected_values, "")),
          "variable": ["intercept"]
          + [
              " = ".join(pair)
              for pair in zip(selected.index, selected_values)
          ]
          + ["prediction"],
          "cumulative": cumulative,
          "contribution": contribution,
          "sign": np.sign(contribution),
          "position": np.arange(len(selected.index) + 1, -1, -1),
          "label": explainer.label,
      }
  
      return result, yhats
  
file_path: DALEX/python/dalex/dalex/predict_explanations/_break_down/utils.py
imports: from copy import deepcopy
  import numpy
  import pandas
label_desc: Use image node_id 5 for calling a global function with example usage: calculate_contributions_along_path(explainer, new_observation, feature_path, baseline_yhat, target_yhat, type, keep_distributions) and returns: result,  yhats