code: def _estimate_iccs(
      attribution_func: Callable[[np.ndarray, np.ndarray], float],
      prediction_method: Callable[[np.ndarray], np.ndarray],
      noise_samples: np.ndarray,
      baseline_noise_samples: np.ndarray,
      max_batch_size: int,
      shapley_config: ShapleyConfig,
  ):
      target_values = shape_into_2d(
          prediction_method(baseline_noise_samples)
      )
  
      def icc_set_function(
          subset: np.ndarray,
      ) -> Union[np.ndarray, float]:
          if np.all(subset == 1):
              # In case of the full subset (no randomization), we get the same predictions as when we apply the
              # prediction method to the samples of interest, since all noise samples are replaced with a sample of
              # interest.
              predictions = target_values
          elif np.all(subset == 0):
              # In case of the empty subset (all are jointly randomize), it boils down to taking the average over all
              # predictions, seeing that the randomization yields the same values for each sample of interest (none of the
              # samples of interest are used to replace a (jointly) 'randomized' sample).
              predictions = repmat(
                  np.mean(prediction_method(noise_samples), axis=0),
                  baseline_noise_samples.shape[0],
                  1,
              )
          else:
              predictions = marginal_expectation(
                  prediction_method,
                  feature_samples=noise_samples,
                  baseline_samples=baseline_noise_samples,
                  baseline_feature_indices=np.arange(
                      0, noise_samples.shape[1]
                  )[subset == 1],
                  return_averaged_results=True,
                  feature_perturbation="randomize_columns_jointly",
                  max_batch_size=max_batch_size,
              )
          return attribution_func(
              shape_into_2d(predictions), target_values
          )
  
      return estimate_shapley_values(
          icc_set_function, noise_samples.shape[1], shapley_config
      )
  
imports: import logging
  import warnings
  from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union, cast
  import numpy
  import pandas
  from joblib import Parallel, delayed
  from numpy.matlib import repmat
  import dowhy.gcm.auto
  from dowhy.gcm import feature_relevance_sample
  from dowhy.gcm._noise import compute_data_from_noise, compute_noise_from_data, noise_samples_of_ancestors
  from dowhy.gcm.causal_mechanisms import ClassifierFCM, ConditionalStochasticModel, ProbabilityEstimatorModel
  from dowhy.gcm.causal_models import InvertibleStructuralCausalModel, ProbabilisticCausalModel, StructuralCausalModel, validate_causal_dag, validate_node
  from dowhy.gcm.divergence import estimate_kl_divergence_of_probabilities
  from dowhy.gcm.fitting_sampling import draw_samples
  from dowhy.gcm.ml import ClassificationModel, PredictionModel
  from dowhy.gcm.shapley import ShapleyConfig, estimate_shapley_values
  from dowhy.gcm.stats import marginal_expectation
  from dowhy.gcm.uncertainty import estimate_entropy_of_probabilities, estimate_variance
  from dowhy.gcm.util.general import has_categorical, is_categorical, means_difference, set_random_seed, shape_into_2d
  from dowhy.graph import get_ordered_predecessors, is_root_node, node_connected_subgraph_view
label_desc: Use image node_id 6 for calling a global function with example usage: _estimate_iccs(attribution_func, prediction_method, noise_samples, baseline_noise_samples, max_batch_size, shapley_config) and returns: estimate_shapley_values, attribution_func