code: def test_kernel_gpu_cpu_shap(dtype, n_features, n_background, model):
      X_train, X_test, y_train, y_test = create_synthetic_dataset(
          n_samples=n_background + 3,
          n_features=n_features,
          test_size=3,
          noise=0.1,
          dtype=dtype,
      )
  
      mod = model().fit(X_train, y_train)
      explainer, shap_values = get_shap_values(
          model=mod.predict,
          background_dataset=X_train,
          explained_dataset=X_test,
          explainer=KernelExplainer,
      )
  
      exp_v = explainer.expected_value
  
      fx = mod.predict(X_test)
      for test_idx in range(3):
          assert (
              np.sum(shap_values[test_idx]) - abs(fx[test_idx] - exp_v)
          ) <= 1e-5
  
      if has_shap():
          import shap
  
          explainer = shap.KernelExplainer(
              mod.predict, cp.asnumpy(X_train)
          )
          cpu_shap_values = explainer.shap_values(cp.asnumpy(X_test))
  
          assert np.allclose(
              shap_values, cpu_shap_values, rtol=1e-01, atol=1e-01
          )
  
imports: from sklearn.model_selection import train_test_split
  from cuml.testing.utils import create_synthetic_dataset, ClassEnumerator, get_shap_values
  from cuml.datasets import make_regression
  from cuml.internals.import_utils import has_shap
  from cuml.internals.import_utils import has_scipy
  from cuml import KernelExplainer
  from cuml import Lasso
  import sklearn.neighbors
  import pytest
  import math
  from cuml.internals.safe_imports import cpu_only_import
  import cuml
  from cuml.internals.safe_imports import gpu_only_import
label_desc: Use image node_id 5 for calling a global function with example usage: test_kernel_gpu_cpu_shap(dtype, n_features, n_background, model) without return types