docstr: Initialises background data if the user passes a sparse matrix as input. If the
  user specifies feature grouping, then the sparse array is converted to a dense
  array. Otherwise, the original array is returned and handled internally by `shap`
  library.
code: def _(
      self, background_data, *args, **kwargs
  ) -> Union[shap_utils.Data, sparse.spmatrix]:
      """
      Initialises background data if the user passes a sparse matrix as input. If the
      user specifies feature grouping, then the sparse array is converted to a dense
      array. Otherwise, the original array is returned and handled internally by `shap`
      library.
      """
  
      group_names, groups, weights = args
      new_args = (
          (group_names, groups, weights)
          if weights is not None
          else (group_names, groups)
      )
  
      if self.use_groups:
          logger.warning(
              "Grouping is not currently compatible with sparse matrix inputs. "
              "Converting background data sparse array to dense matrix."
          )
          background_data = background_data.toarray()
          return shap_utils.DenseData(
              background_data,
              *new_args,
          )
  
      return background_data
  
imports: import copy
  import logging
  from functools import partial
  from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Sequence, Tuple, Union
  import numpy
  import pandas
  import shap
  import shap.utils._legacy
  from scipy import sparse
  from scipy.special import expit
  from shap import KernelExplainer
  from alibi.api.defaults import DEFAULT_DATA_KERNEL_SHAP, DEFAULT_DATA_TREE_SHAP, DEFAULT_META_KERNEL_SHAP, DEFAULT_META_TREE_SHAP
  from alibi.api.interfaces import Explainer, Explanation, FitMixin
  from alibi.utils.wrappers import methdispatch
label_desc: Use image node_id 7 for calling the KernelShap obj's underlying member method code with example usage: obj._(background_data) and returns: background_data, shap_utils