class_docstr: SHAP explanations for model predictions over tabular data.
  
  Kernel SHAP is used to determine the influence that each input features has
  on the prediction of an output feature, given a dataset and model.
  
  This explainer takes two inputs in its call configuration:
  
  1.  [Required] The "Prediction key" tells the interpreter which feature in
      the output spec to explain. This interpreter returns None if a
      "Prediction key" is not provided.
  
  2.  [Optional] "Sample size" is used to extract a random sample from the
      inputs provided to the run() function. If "Sample size" is 0, run() will
      explain the entire inputs list. Due to the performance characteristics of
      SHAP, it is recommended that you use a sample size ≤ 50, otherwise it is
      very likely that the HTTP request will timeout.
  
  This explainer outputs a list of FeatureSalience objects with the influence of
  each input feature on the predicted value for that input. The size of this
  list is equal to either the length of the inputs or the "Sample size", if the
  latter is > 0. Influence values are normalized in the range of [-1, 1].
class_docstr_tok: ["SHAP","explanations","for","model","predictions","over","tabular","data",".","Kernel","SHAP","is","used","to","determine","the","influence","that","each","input","features","has","on","the","prediction","of","an","output","feature",",","given","a","dataset","and","model",".","This","explainer","takes","two","inputs","in","its","call","configuration",":","1",".","[","Required","]","The","``","Prediction","key","''","tells","the","interpreter","which","feature","in","the","output","spec","to","explain",".","This","interpreter","returns","None","if","a","``","Prediction","key","''","is","not","provided",".","2",".","[","Optional","]","``","Sample","size","''","is","used","to","extract","a","random","sample","from","the","inputs","provided","to","the","run","(",")","function",".","If","``","Sample","size","''","is","0",",","run","(",")","will","explain","the","entire","inputs","list",".","Due","to","the","performance","characteristics","of","SHAP",",","it","is","recommended","that","you","use","a","sample","size","\u2264","50",",","otherwise","it","is","very","likely","that","the","HTTP","request","will","timeout",".","This","explainer","outputs","a","list","of","FeatureSalience","objects","with","the","influence","of","each","input","feature","on","the","predicted","value","for","that","input",".","The","size","of","this","list","is","equal","to","either","the","length","of","the","inputs","or","the","``","Sample","size","''",",","if","the","latter","is",">","0",".","Influence","values","are","normalized","in","the","range","of","[","-1",",","1","]","."]
code: def config_spec(self) -> types.Spec:
      return {
          EXPLAIN_KEY: types.SingleFieldMatcher(
              spec="output",
              types=[
                  "MulticlassPreds",
                  "RegressionScore",
                  "Scalar",
                  "SparseMultilabelPreds",
              ],
          ),
          SAMPLE_KEY: types.Scalar(
              min_val=0, max_val=50, default=30, step=1
          ),
      }
  
file_path: lit/lit_nlp/components/shap_explainer.py
imports: from typing import Optional, Union
  from lit_nlp.api import components
  from lit_nlp.api import dataset
  from lit_nlp.api import dtypes
  from lit_nlp.api import model
  from lit_nlp.api import types
  from lit_nlp.lib import utils
  import numpy
  import pandas
  import shap
label_desc: Use image node_id 3 for calling the TabularShapExplainer obj's underlying member method code with example usage: obj.config_spec() and returns: dict