code: def test_non_numeric():
      """Test using non-numeric data."""
  
      # create dummy data
      X = np.array(
          [
              ["A", "0", "0"],
              ["A", "1", "0"],
              ["B", "0", "0"],
              ["B", "1", "0"],
              ["A", "1", "0"],
          ]
      )
      y = np.array([0, 1, 2, 3, 4])
  
      # build and train the pipeline
      pipeline = sklearn.pipeline.Pipeline(
          [
              ("oneHotEncoder", sklearn.preprocessing.OneHotEncoder()),
              ("linear", sklearn.linear_model.LinearRegression()),
          ]
      )
      pipeline.fit(X, y)
  
      # use KernelExplainer
      explainer = shap.KernelExplainer(
          pipeline.predict, X, nsamples=100
      )
      shap_values = explainer.explain(X[0, :].reshape(1, -1))
  
      assert (
          np.abs(
              explainer.expected_value
              + shap_values.sum(0)
              - pipeline.predict(X[0, :].reshape(1, -1))[0]
          )
          < 1e-4
      )
      assert shap_values[2] == 0
  
      # tests for shap.KernelExplainer.not_equal
      assert shap.KernelExplainer.not_equal(
          0, 0
      ) == shap.KernelExplainer.not_equal("0", "0")
      assert shap.KernelExplainer.not_equal(
          0, 1
      ) == shap.KernelExplainer.not_equal("0", "1")
      assert shap.KernelExplainer.not_equal(
          0, np.nan
      ) == shap.KernelExplainer.not_equal("0", np.nan)
      assert shap.KernelExplainer.not_equal(
          0, np.nan
      ) == shap.KernelExplainer.not_equal("0", None)
      assert shap.KernelExplainer.not_equal(
          np.nan, 0
      ) == shap.KernelExplainer.not_equal(np.nan, "0")
      assert shap.KernelExplainer.not_equal(
          np.nan, 0
      ) == shap.KernelExplainer.not_equal(None, "0")
      assert shap.KernelExplainer.not_equal("ab", "bc")
      assert not shap.KernelExplainer.not_equal("ab", "ab")
      assert shap.KernelExplainer.not_equal(
          pd.Timestamp("2017-01-01T12"), pd.Timestamp("2017-01-01T13")
      )
      assert not shap.KernelExplainer.not_equal(
          pd.Timestamp("2017-01-01T12"), pd.Timestamp("2017-01-01T12")
      )
      assert shap.KernelExplainer.not_equal(
          pd.Timestamp("2017-01-01T12"), pd.Timestamp("2017-01-01T13")
      )
      assert shap.KernelExplainer.not_equal(
          pd.Period("4Q2005"), pd.Period("3Q2005")
      )
      assert not shap.KernelExplainer.not_equal(
          pd.Period("4Q2005"), pd.Period("4Q2005")
      )
  
file_path: shap/tests/explainers/test_kernel.py
imports: import numpy
  import pandas
  import scipy.sparse
  import sklearn
  import shap
label_desc: Use image node_id 13 for calling a global function with example usage: test_non_numeric() without return types