code: def check_efficiency(expected_value, pred, shap_values):
      # shap values add up to prediction
      if len(shap_values.shape) <= 2:
          assert np.allclose(
              np.sum(shap_values, axis=-1) + expected_value,
              pred,
              1e-3,
              1e-3,
          )
      else:
          n_targets = shap_values.shape[0]
          for i in range(n_targets):
              assert np.allclose(
                  np.sum(shap_values[i], axis=-1) + expected_value[i],
                  pred[:, i],
                  1e-3,
                  1e-3,
              )
  
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 19 for calling a global function with example usage: check_efficiency(expected_value, pred, shap_values) without return types