docstr: If user specifies parameter grouping, then we check input is correct or inform
  them if the settings they put might not behave as expected.
code: def _check_inputs(
      self,
      background_data: Union[
          shap_utils.Data, pd.DataFrame, np.ndarray, sparse.spmatrix
      ],
      group_names: Union[Tuple, List, None],
      groups: Optional[List[Union[Tuple[int], List[int]]]],
      weights: Union[
          Union[List[float], Tuple[float]], np.ndarray, None
      ],
  ) -> None:
      """
      If user specifies parameter grouping, then we check input is correct or inform
      them if the settings they put might not behave as expected.
      """
  
      if isinstance(background_data, shap_utils.Data):
          # don't provide checks for situations where the user passes
          # the data object directly
          if not self.summarise_background:
              self.use_groups = False
              return
          # if summarisation took place, we do the checks to ensure everything is correct
          else:
              background_data = background_data.data
  
      if (
          isinstance(background_data, np.ndarray)
          and background_data.ndim == 1
      ):
          background_data = np.atleast_2d(background_data)
  
      if background_data.shape[0] > KERNEL_SHAP_BACKGROUND_THRESHOLD:
          msg = (
              "Large datasets can cause slow runtimes for shap. The background dataset "
              "provided has {} records. Consider passing a subset or allowing the algorithm "
              "to automatically summarize the data by setting the summarise_background=True or"
              "setting summarise_background to 'auto' which will default to {} samples!"
          )
          logger.warning(
              msg.format(
                  background_data.shape[0],
                  KERNEL_SHAP_BACKGROUND_THRESHOLD,
              )
          )
  
      if group_names and not groups:
          logger.info(
              "Specified group_names but no corresponding sequence 'groups' with indices "
              "for each group was specified. All groups will have len=1."
          )
          if not len(group_names) in background_data.shape:
              msg = (
                  "Specified {} group names but data dimension is {}. When grouping "
                  "indices are not specifies the number of group names should equal "
                  "one of the data dimensions! Igoring grouping inputs!"
              )
              logger.warning(
                  msg.format(len(group_names), background_data.shape)
              )
              self.use_groups = False
  
      if groups and not group_names:
          logger.warning(
              "No group names specified but groups specified! Automatically "
              "assigning 'group_' name for every index group specified!"
          )
          if self.feature_names:
              n_groups = len(groups)
              n_features = len(self.feature_names)
              if n_features != n_groups:
                  msg = (
                      "Number of feature names specified did not match the number of groups."
                      "Specified {} groups and {} features names. Creating default names for "
                      "specified groups"
                  )
                  logger.warning(msg.format(n_groups, n_features))
                  self.create_group_names = True
              else:
                  group_names = self.feature_names
          else:
              self.create_group_names = True
  
      if groups:
          if not (
              isinstance(groups[0], tuple)
              or isinstance(groups[0], list)
          ):
              msg = (
                  "groups should be specified as List[Union[Tuple[int], List[int]]] where each "
                  "sublist represents a group and int represent group instance. Specified group "
                  "elements have type {}. Ignoring grouping inputs!"
              )
              logger.warning(msg.format(type(groups[0])))
              self.use_groups = False
  
          expected_dim = sum(len(g) for g in groups)
          if background_data.ndim == 1:
              actual_dim = background_data.shape[0]
          else:
              actual_dim = background_data.shape[1]
          if expected_dim != actual_dim:
              if background_data.shape[0] == expected_dim:
                  logger.warning(
                      "The sum of the group indices list did not match the "
                      "data dimension along axis=1 but matched dimension "
                      "along axis=0. Consider transposing the data!"
                  )
                  self.transposed = True
              else:
                  msg = (
                      "The sum of the group sizes specified did not match the number of features. "
                      "Sum of group sizes: {}. Number of features: {}. Ignoring grouping inputs!"
                  )
                  logger.warning(msg.format(expected_dim, actual_dim))
                  self.use_groups = False
  
          if group_names:
              n_groups = len(groups)
              n_group_names = len(group_names)
              if n_group_names != n_groups:
                  msg = (
                      "The number of group names specified does not match the number of groups. "
                      "Received {} groups and {} names! Ignoring grouping inputs!"
                  )
                  logger.warning(msg.format(n_groups, n_group_names))
                  self.use_groups = False
  
      if weights is not None:
          if background_data.ndim == 1 or background_data.shape[0] == 1:
              logger.warning(
                  "Specified weights but the background data has only one record. "
                  "Weights will be ignored!"
              )
              self.ignore_weights = True
          else:
              data_dim = background_data.shape[0]
              feat_dim = background_data.shape[1]
              weights_dim = len(weights)
              if data_dim != weights_dim:
                  if not (feat_dim == weights_dim and self.transposed):
                      msg = (
                          "The number of weights specified did not match data dimension. "
                          "Number of weights: {}. Number of datapoints: {}. Weights will "
                          "be ignored!"
                      )
                      logger.warning(msg.format(weights_dim, data_dim))
                      self.ignore_weights = True
  
          # NB: we have already summarised the data at this point
          if self.summarise_background:
              weights_dim = len(weights)
              if background_data.ndim == 1:
                  n_background_samples = 1
              else:
                  if not self.transposed:
                      n_background_samples = background_data.shape[0]
                  else:
                      n_background_samples = background_data.shape[1]
  
              if weights_dim != n_background_samples:
                  msg = (
                      "The number of weights vector provided ({}) did not match the number of "
                      "summary data points ({}). The weights provided will be ignored!"
                  )
                  logger.warning(
                      msg.format(weights_dim, n_background_samples)
                  )
  
                  self.ignore_weights = True
  
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 2 for calling the KernelShap obj's underlying member method code with example usage: obj._check_inputs(background_data, group_names, groups, weights) without return types