class_docstr: Explains a model using expected gradients (an extension of integrated gradients).
  
  Expected gradients an extension of the integrated gradients method (Sundararajan et al. 2017), a
  feature attribution method designed for differentiable models based on an extension of Shapley
  values to infinite player games (Aumann-Shapley values). Integrated gradients values are a bit
  different from SHAP values, and require a single reference value to integrate from. As an adaptation
  to make them approximate SHAP values, expected gradients reformulates the integral as an expectation
  and combines that expectation with sampling reference values from the background dataset. This leads
  to a single combined expectation of gradients that converges to attributions that sum to the
  difference between the expected model output and the current output.
  
  Examples
  --------
  See :ref:`Gradient Explainer Examples <gradient_explainer_examples>`
docstr: Return the values for the model applied to X.
  
  Parameters
  ----------
  X : list,
      if framework == 'tensorflow': numpy.array, or pandas.DataFrame
      if framework == 'pytorch': torch.tensor
      A tensor (or list of tensors) of samples (where X.shape[0] == # samples) on which to
      explain the model's output.
  
  ranked_outputs : None or int
      If ranked_outputs is None then we explain all the outputs in a multi-output model. If
      ranked_outputs is a positive integer then we only explain that many of the top model
      outputs (where "top" is determined by output_rank_order). Note that this causes a pair
      of values to be returned (shap_values, indexes), where shap_values is a list of numpy arrays
      for each of the output ranks, and indexes is a matrix that tells for each sample which output
      indexes were chosen as "top".
  
  output_rank_order : "max", "min", "max_abs", or "custom"
      How to order the model outputs when using ranked_outputs, either by maximum, minimum, or
      maximum absolute value. If "custom" Then "ranked_outputs" contains a list of output nodes.
  
  rseed : None or int
      Seeding the randomness in shap value computation  (background example choice,
      interpolation between current and background example, smoothing).
  
  Returns
  -------
  array or list
      For a models with a single output this returns a tensor of SHAP values with the same shape
      as X. For a model with multiple outputs this returns a list of SHAP value tensors, each of
      which are the same shape as X. If ranked_outputs is None then this list of tensors matches
      the number of model outputs. If ranked_outputs is a positive integer a pair is returned
      (shap_values, indexes), where shap_values is a list of tensors with a length of
      ranked_outputs, and indexes is a matrix that tells for each sample which output indexes
      were chosen as "top".
docstr_tok: ["Return","the","values","for","the","model","applied","to","X.","Parameters","--","--","--","--","--","X",":","list",",","if","framework","==","'tensorflow","'",":","numpy.array",",","or","pandas.DataFrame","if","framework","==","'pytorch","'",":","torch.tensor","A","tensor","(","or","list","of","tensors",")","of","samples","(","where","X.shape","[","0","]","==","#","samples",")","on","which","to","explain","the","model","'s","output",".","ranked_outputs",":","None","or","int","If","ranked_outputs","is","None","then","we","explain","all","the","outputs","in","a","multi-output","model",".","If","ranked_outputs","is","a","positive","integer","then","we","only","explain","that","many","of","the","top","model","outputs","(","where","``","top","''","is","determined","by","output_rank_order",")",".","Note","that","this","causes","a","pair","of","values","to","be","returned","(","shap_values",",","indexes",")",",","where","shap_values","is","a","list","of","numpy","arrays","for","each","of","the","output","ranks",",","and","indexes","is","a","matrix","that","tells","for","each","sample","which","output","indexes","were","chosen","as","``","top","''",".","output_rank_order",":","``","max","''",",","``","min","''",",","``","max_abs","''",",","or","``","custom","''","How","to","order","the","model","outputs","when","using","ranked_outputs",",","either","by","maximum",",","minimum",",","or","maximum","absolute","value",".","If","``","custom","''","Then","``","ranked_outputs","''","contains","a","list","of","output","nodes",".","rseed",":","None","or","int","Seeding","the","randomness","in","shap","value","computation","(","background","example","choice",",","interpolation","between","current","and","background","example",",","smoothing",")",".","Returns","--","--","--","-","array","or","list","For","a","models","with","a","single","output","this","returns","a","tensor","of","SHAP","values","with","the","same","shape","as","X",".","For","a","model","with","multiple","outputs","this","returns","a","list","of","SHAP","value","tensors",",","each","of","which","are","the","same","shape","as","X",".","If","ranked_outputs","is","None","then","this","list","of","tensors","matches","the","number","of","model","outputs",".","If","ranked_outputs","is","a","positive","integer","a","pair","is","returned","(","shap_values",",","indexes",")",",","where","shap_values","is","a","list","of","tensors","with","a","length","of","ranked_outputs",",","and","indexes","is","a","matrix","that","tells","for","each","sample","which","output","indexes","were","chosen","as","``","top","''","."]
code: def shap_values(
      self,
      X,
      nsamples=200,
      ranked_outputs=None,
      output_rank_order="max",
      rseed=None,
      return_variances=False,
  ):
      """Return the values for the model applied to X.
  
      Parameters
      ----------
      X : list,
          if framework == 'tensorflow': numpy.array, or pandas.DataFrame
          if framework == 'pytorch': torch.tensor
          A tensor (or list of tensors) of samples (where X.shape[0] == # samples) on which to
          explain the model's output.
  
      ranked_outputs : None or int
          If ranked_outputs is None then we explain all the outputs in a multi-output model. If
          ranked_outputs is a positive integer then we only explain that many of the top model
          outputs (where "top" is determined by output_rank_order). Note that this causes a pair
          of values to be returned (shap_values, indexes), where shap_values is a list of numpy arrays
          for each of the output ranks, and indexes is a matrix that tells for each sample which output
          indexes were chosen as "top".
  
      output_rank_order : "max", "min", "max_abs", or "custom"
          How to order the model outputs when using ranked_outputs, either by maximum, minimum, or
          maximum absolute value. If "custom" Then "ranked_outputs" contains a list of output nodes.
  
      rseed : None or int
          Seeding the randomness in shap value computation  (background example choice,
          interpolation between current and background example, smoothing).
  
      Returns
      -------
      array or list
          For a models with a single output this returns a tensor of SHAP values with the same shape
          as X. For a model with multiple outputs this returns a list of SHAP value tensors, each of
          which are the same shape as X. If ranked_outputs is None then this list of tensors matches
          the number of model outputs. If ranked_outputs is a positive integer a pair is returned
          (shap_values, indexes), where shap_values is a list of tensors with a length of
          ranked_outputs, and indexes is a matrix that tells for each sample which output indexes
          were chosen as "top".
      """
      return self.explainer.shap_values(
          X,
          nsamples,
          ranked_outputs,
          output_rank_order,
          rseed,
          return_variances,
      )
  
imports: import warnings
  import numpy
  import pandas
  from packaging import version
  from .._explanation import Explanation
  from ..explainers._explainer import Explainer
  from ..explainers.tf_utils import _get_graph, _get_model_inputs, _get_model_output, _get_session
label_desc: Use image node_id 3 for calling the GradientExplainer obj's underlying member method code with example usage: obj.shap_values(X, nsamples, ranked_outputs, output_rank_order, rseed, return_variances) and returns: self