code: def _check_convergence(
      new_shap_proxy: np.ndarray,
      old_shap_proxy: np.ndarray,
      min_percentage_change_threshold: float,
  ) -> Tuple[np.ndarray, float]:
      non_zero_indices = old_shap_proxy != 0
      converging = np.array([True] * new_shap_proxy.shape[0])
  
      percentages = abs(
          1
          - new_shap_proxy[non_zero_indices]
          / old_shap_proxy[non_zero_indices]
      )
  
      # Check if change in percentage is below threshold
      converging[non_zero_indices] = (
          percentages < min_percentage_change_threshold
      )
  
      # Check for values that are exactly zero. If they don't change between two runs, we consider it as converging.
      converging[~non_zero_indices] = (
          new_shap_proxy[~non_zero_indices]
          == old_shap_proxy[~non_zero_indices]
      )
  
      if np.all(~non_zero_indices):
          mean_percentage_change = 1
      else:
          mean_percentage_change = np.mean(percentages)
  
      return converging, mean_percentage_change
  
imports: import itertools
  import math
  from enum import Enum
  from typing import Callable, Dict, List, Optional, Set, Tuple, Union
  import numpy
  import scipy
  from joblib import Parallel, delayed
  from scipy.special import comb
  from scipy.stats._qmc import Halton
  from sklearn.linear_model import LinearRegression
  from tqdm import tqdm
  import dowhy.gcm.config
  from dowhy.gcm.util.general import set_random_seed
label_desc: Use image node_id 6 for calling a global function with example usage: _check_convergence(new_shap_proxy, old_shap_proxy, min_percentage_change_threshold) and returns: converging,  mean_percentage_change