code: def test_Shap(self):
      np.random.seed(1)
      X_train, X_test, Y_train, Y_test = train_test_split(
          *shap.datasets.iris(), test_size=0.2, random_state=0
      )
  
      # K-nearest neighbors
      knn = sklearn.neighbors.KNeighborsClassifier()
      knn.fit(X_train, Y_train)
      v = 100 * np.sum(knn.predict(X_test) == Y_test) / len(Y_test)
      print("Accuracy = {0}%".format(v))
  
      # Explain a single prediction from the test set
      shapexplainer = KernelExplainer(knn.predict_proba, X_train)
      shap_values = shapexplainer.explain_instance(
          X_test.iloc[0, :]
      )  # TODO test against original SHAP Lib
      print("knn X_test iloc_0")
      print(shap_values)
      print(shapexplainer.explainer.expected_value[0])
      print(shap_values[0])
  
      # Explain all the predictions in the test set
      shap_values = shapexplainer.explain_instance(X_test)
      print("knn X_test")
      print(shap_values)
      print(shapexplainer.explainer.expected_value[0])
      print(shap_values[0])
  
      # SV machine with a linear kernel
      svc_linear = sklearn.svm.SVC(kernel="linear", probability=True)
      svc_linear.fit(X_train, Y_train)
      v = (
          100
          * np.sum(svc_linear.predict(X_test) == Y_test)
          / len(Y_test)
      )
      print("Accuracy = {0}%".format(v))
  
      # Explain all the predictions in the test set
      shapexplainer = KernelExplainer(svc_linear.predict_proba, X_train)
      shap_values = shapexplainer.explain_instance(X_test)
      print("svc X_test")
      print(shap_values)
      print(shapexplainer.explainer.expected_value[0])
      print(shap_values[0])
  
      np.random.seed(1)
      X, y = shap.datasets.adult()
      (
          X_train,
          X_valid,
          y_train,
          y_valid,
      ) = sklearn.model_selection.train_test_split(
          X, y, test_size=0.2, random_state=7
      )
  
      knn = sklearn.neighbors.KNeighborsClassifier()
      knn.fit(X_train, y_train)
  
      f = lambda x: knn.predict_proba(x)[:, 1]
      med = X_train.median().values.reshape((1, X_train.shape[1]))
      shapexplainer = KernelExplainer(f, med)
      shap_values_single = shapexplainer.explain_instance(
          X.iloc[0, :], nsamples=1000
      )
      print("Shap Tabular Example")
      print(shapexplainer.explainer.expected_value)
      print(shap_values_single)
      print("Invoked Shap KernelExplainer")
  
imports: from __future__ import print_function
  import unittest
  import sklearn
  import sklearn.datasets
  import sklearn.ensemble
  from sklearn.feature_extraction.text import TfidfVectorizer
  from sklearn.model_selection import train_test_split
  import numpy
  import keras
  from keras.applications.vgg16 import VGG16
  from keras.applications.vgg16 import preprocess_input, decode_predictions
  from keras.datasets import mnist
  from keras.models import Sequential
  from keras.layers import Dense, Dropout, Flatten
  from keras.layers import Conv2D, MaxPooling2D
  import keras.backend
  import json
  import xgboost
  from aix360.algorithms.shap import KernelExplainer, LinearExplainer, GradientExplainer, DeepExplainer, TreeExplainer
  import shap
label_desc: Use image node_id 1 for calling the TestShapExplainer obj's underlying member method code with example usage: obj.test_Shap() without return types