code: def test__summarise_background_kernel(
      caplog,
      mock_kernel_shap_explainer,
      data_dimension,
      data_type,
      use_groups,
      categorical_names,
  ):
      caplog.set_level(logging.INFO)
      # create testing inputs
      n_samples, n_features = data_dimension
      n_bckg_samples = n_samples - 5
      background_data = get_data(
          data_type, n_rows=n_samples, n_cols=n_features
      )
  
      # initialise explainer
      explainer = mock_kernel_shap_explainer
      explainer.categorical_names = categorical_names
      explainer.use_groups = use_groups
      summary_data = explainer._summarise_background(
          background_data, n_bckg_samples
      )
  
      if data_type == "data":
          msg = (
              "Received option to summarise the data but the background_data object was an "
              "instance of shap_utils.Data"
          )
          assert_message_in_logs(msg, caplog.records)
          assert type(background_data) == type(
              summary_data
          )  # noqa: E721
      else:
          if use_groups or categorical_names:
              assert type(background_data) == type(
                  summary_data
              )  # noqa: E721
              if data_type == "series":
                  assert summary_data.shape == background_data.shape
              else:
                  assert summary_data.shape == (
                      n_bckg_samples,
                      n_features,
                  )
          else:
              if data_type == "sparse":
                  assert summary_data.shape == (
                      n_bckg_samples,
                      n_features,
                  )
              elif data_type == "series":
                  assert summary_data.shape == background_data.shape
              else:
                  assert isinstance(summary_data, shap_utils.DenseData)
                  assert summary_data.data.shape == (
                      n_bckg_samples,
                      n_features,
                  )
  
imports: import itertools
  import logging
  import unittest
  from copy import copy
  from itertools import chain
  from unittest.mock import MagicMock
  from typing import Any, List
  import catboost
  import pandas
  import pytest
  import scipy.sparse
  import sklearn
  import shap
  import numpy
  import pandas
  import shap.utils._legacy
  from numpy.testing import assert_allclose, assert_almost_equal
  from scipy.special import expit
  from alibi.api.defaults import DEFAULT_META_KERNEL_SHAP, DEFAULT_DATA_KERNEL_SHAP, DEFAULT_META_TREE_SHAP, DEFAULT_DATA_TREE_SHAP, KERNEL_SHAP_PARAMS, TREE_SHAP_PARAMS
  from alibi.explainers.shap_wrappers import sum_categories, rank_by_importance, KernelExplainerWrapper
  from alibi.explainers.shap_wrappers import KERNEL_SHAP_BACKGROUND_THRESHOLD, TREE_SHAP_BACKGROUND_WARNING_THRESHOLD
  from alibi.explainers.tests.utils import get_random_matrix
  from alibi.tests.utils import assert_message_in_logs, not_raises
  from alibi.utils import DistributedExplainer
label_desc: Use image node_id 16 for calling a global function with example usage: test__summarise_background_kernel(caplog, mock_kernel_shap_explainer, data_dimension, data_type, use_groups, categorical_names) without return types