code: def test_kernel_shap_with_high_dim_sparse():
      """Verifies we can run on very sparse data produced from feature hashing."""
  
      remove = ("headers", "footers", "quotes")
      categories = [
          "alt.atheism",
          "talk.religion.misc",
          "comp.graphics",
          "sci.space",
      ]
      ngroups = sklearn.datasets.fetch_20newsgroups(
          subset="train",
          categories=categories,
          shuffle=True,
          random_state=42,
          remove=remove,
      )
      (
          x_train,
          x_test,
          y_train,
          _,
      ) = sklearn.model_selection.train_test_split(
          ngroups.data, ngroups.target, test_size=0.01, random_state=42
      )
      vectorizer = sklearn.feature_extraction.text.HashingVectorizer(
          stop_words="english", alternate_sign=False, n_features=2**16
      )
      x_train = vectorizer.transform(x_train)
      x_test = vectorizer.transform(x_test)
      # Fit a linear regression model
      linear_model = sklearn.linear_model.LinearRegression()
      linear_model.fit(x_train, y_train)
      _, cols = x_train.shape
      shape = 1, cols
      background = scipy.sparse.csr_matrix(shape, dtype=x_train.dtype)
      explainer = shap.KernelExplainer(linear_model.predict, background)
      _ = explainer.shap_values(x_test)
  
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 10 for calling a global function with example usage: test_kernel_shap_with_high_dim_sparse() without return types