docstr: Config for estimating Shapley values.
  
  :param approximation_method: Type of approximation methods (see :py:class:`ShapleyApproximationMethods <dowhy.gcm.shapley.ShapleyApproximationMethods>`).
  :param num_permutations: Number of permutations used for approximating the Shapley values. This value is only
                           used for PERMUTATION and EARLY_STOPPING. In both cases, it indicates the maximum
                           number of permutations that are evaluated. Note that EARLY_STOPPING might stop before
                           reaching the number of permutations if the change in Shapley values fall below
                           min_percentage_change_threshold.
  :param num_subset_samples: Number of subsets used for the SUBSET_SAMPLING method. This value is not used
                             otherwise.
  :param min_percentage_change_threshold: This parameter is only relevant for EARLY_STOPPING and indicates the
                                          minimum required change in percentage of the Shapley values between two
                                          runs before the estimation stops. For instance, with a value of 0.01
                                          the estimation would stop if all Shapley values change less than 0.01
                                          per run. To mitigate the impact of randomness, the changes need to stay
                                          below the threshold for at least 2 consecutive runs.
  :param n_jobs: Number of parallel jobs.
docstr_tok: ["Config","for","estimating","Shapley","values",".",":","param","approximation_method",":","Type","of","approximation","methods","(","see",":","py",":","class",":","`","ShapleyApproximationMethods","<","dowhy.gcm.shapley.ShapleyApproximationMethods",">","`",")",".",":","param","num_permutations",":","Number","of","permutations","used","for","approximating","the","Shapley","values",".","This","value","is","only","used","for","PERMUTATION","and","EARLY_STOPPING",".","In","both","cases",",","it","indicates","the","maximum","number","of","permutations","that","are","evaluated",".","Note","that","EARLY_STOPPING","might","stop","before","reaching","the","number","of","permutations","if","the","change","in","Shapley","values","fall","below","min_percentage_change_threshold",".",":","param","num_subset_samples",":","Number","of","subsets","used","for","the","SUBSET_SAMPLING","method",".","This","value","is","not","used","otherwise",".",":","param","min_percentage_change_threshold",":","This","parameter","is","only","relevant","for","EARLY_STOPPING","and","indicates","the","minimum","required","change","in","percentage","of","the","Shapley","values","between","two","runs","before","the","estimation","stops",".","For","instance",",","with","a","value","of","0.01","the","estimation","would","stop","if","all","Shapley","values","change","less","than","0.01","per","run",".","To","mitigate","the","impact","of","randomness",",","the","changes","need","to","stay","below","the","threshold","for","at","least","2","consecutive","runs",".",":","param","n_jobs",":","Number","of","parallel","jobs","."]
code: def __init__(
      self,
      approximation_method: ShapleyApproximationMethods = ShapleyApproximationMethods.AUTO,
      num_permutations: int = 2000,
      num_subset_samples: int = 5000,
      min_percentage_change_threshold: float = 0.05,
      n_jobs: Optional[int] = None,
  ) -> None:
      """Config for estimating Shapley values.
  
      :param approximation_method: Type of approximation methods (see :py:class:`ShapleyApproximationMethods <dowhy.gcm.shapley.ShapleyApproximationMethods>`).
      :param num_permutations: Number of permutations used for approximating the Shapley values. This value is only
                               used for PERMUTATION and EARLY_STOPPING. In both cases, it indicates the maximum
                               number of permutations that are evaluated. Note that EARLY_STOPPING might stop before
                               reaching the number of permutations if the change in Shapley values fall below
                               min_percentage_change_threshold.
      :param num_subset_samples: Number of subsets used for the SUBSET_SAMPLING method. This value is not used
                                 otherwise.
      :param min_percentage_change_threshold: This parameter is only relevant for EARLY_STOPPING and indicates the
                                              minimum required change in percentage of the Shapley values between two
                                              runs before the estimation stops. For instance, with a value of 0.01
                                              the estimation would stop if all Shapley values change less than 0.01
                                              per run. To mitigate the impact of randomness, the changes need to stay
                                              below the threshold for at least 2 consecutive runs.
      :param n_jobs: Number of parallel jobs.
      """
      self.approximation_method = approximation_method
      self.num_permutations = num_permutations
      self.num_subset_samples = num_subset_samples
      self.min_percentage_change_threshold = (
          min_percentage_change_threshold
      )
      self.n_jobs = config.default_n_jobs if n_jobs is None else n_jobs
  
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 1 to create a new ShapleyConfig object  with example: obj = ShapleyConfig(approximation_method, num_permutations, num_subset_samples, min_percentage_change_threshold, n_jobs)