class_docstr: A class that orchestrates the execution of the execution of a batch of explanations in parallel.
class_docstr_tok: ["A","class","that","orchestrates","the","execution","of","the","execution","of","a","batch","of","explanations","in","parallel","."]
docstr: Performs distributed explanations of instances in `X`.
  
  Parameters
  ----------
  X
      A batch of instances to be explained. Split into batches according to the settings passed to the constructor.
  **kwargs
      Any keyword-arguments for the explainer `explain` method. 
  
  Returns
  --------
  The explanations are returned as
  
   - a generator, if the `return_generator` option is specified. This is used so that the caller can access         the results as they are computed. This is the only case when this method is non-blocking and the caller         needs to call `next` on the generator to trigger the parallel computation.
  
   - a list of objects, whose type depends on the return type of the explainer. This is returned  if no         custom preprocessing function is specified.
  
   - an object, whose type depends on the return type of the concatenation function return when called with         a list of minibatch results with the same order as the minibatches.
      
code: def get_explanation(
      self, X: np.ndarray, **kwargs
  ) -> Union[Generator[Tuple[int, Any], None, None], List[Any], Any]:
      """
          Performs distributed explanations of instances in `X`.
  
          Parameters
          ----------
          X
              A batch of instances to be explained. Split into batches according to the settings passed to the constructor.
          **kwargs
              Any keyword-arguments for the explainer `explain` method. 
  
          Returns
          --------
          The explanations are returned as
      
           - a generator, if the `return_generator` option is specified. This is used so that the caller can access \
          the results as they are computed. This is the only case when this method is non-blocking and the caller \
          needs to call `next` on the generator to trigger the parallel computation.
          
           - a list of objects, whose type depends on the return type of the explainer. This is returned  if no \
          custom preprocessing function is specified.
          
           - an object, whose type depends on the return type of the concatenation function return when called with \
          a list of minibatch results with the same order as the minibatches.
              
          """  # noqa E501
  
      if kwargs is not None:
          self.target_fcn = partial(self.target_fcn, kwargs=kwargs)
      batched_instances = batch(X, self.batch_size, self.n_processes)
  
      # non-blocking, as results finish
      if self.return_generator:
          # note: do not use this option inside a remote object generators cannot be pickled
          return self.pool.map_unordered(
              self.target_fcn, enumerate(batched_instances)
          )
  
      # blocking, submit order
      explanations = self.pool.map(self.target_fcn, batched_instances)
      results = [
          minibatch_explanation
          for minibatch_explanation in explanations
      ]
  
      if self.concatenate_results:
          return self.concatenate(results)
      return results
  
imports: import copy
  import logging
  from functools import partial
  from typing import Any, Callable, Dict, Generator, List, Optional, Tuple, Union
  import numpy
  from scipy import sparse
  import ray
label_desc: Use image node_id 8 for calling the DistributedExplainer obj's underlying member method code with example usage: obj.get_explanation(X) and returns: results, self, self