code: def test_xgb_toy_categorical():
      X = pd.DataFrame(
          {
              "dummy": np.zeros(5, dtype=np.float32),
              "x": np.array([0, 1, 2, 3, 4], dtype=np.int32),
          }
      )
      y = np.array([0, 0, 1, 1, 1], dtype=np.float32)
      X["x"] = X["x"].astype("category")
      dtrain = xgb.DMatrix(X, y, enable_categorical=True)
      params = {
          "tree_method": "gpu_hist",
          "eval_metric": "error",
          "objective": "binary:logistic",
          "max_depth": 2,
          "min_child_weight": 0,
          "lambda": 0,
      }
      xgb_model = xgb.train(
          params, dtrain, num_boost_round=1, evals=[(dtrain, "train")]
      )
      explainer = TreeExplainer(model=xgb_model)
      out = explainer.shap_values(X)
  
      ref_out = xgb_model.predict(dtrain, pred_contribs=True)
      np.testing.assert_almost_equal(out, ref_out[:, :-1], decimal=5)
      np.testing.assert_almost_equal(
          explainer.expected_value, ref_out[0, -1], decimal=5
      )
  
imports: from cuml.testing.utils import as_type
  import cuml
  from cuml.ensemble import RandomForestClassifier
  from cuml.ensemble import RandomForestRegressor
  from cuml.common.exceptions import NotFittedError
  from cuml.internals.import_utils import has_sklearn
  from cuml.internals.import_utils import has_lightgbm, has_shap
  from cuml.explainer.tree_shap import TreeExplainer
  from hypothesis import given, settings, assume, HealthCheck, strategies
  from cuml.internals.safe_imports import gpu_only_import
  import json
  import pytest
  import treelite
  from cuml.internals.safe_imports import cpu_only_import
label_desc: Use image node_id 12 for calling a global function with example usage: test_xgb_toy_categorical() without return types