code: def calculate_variable_profile(
      predict_function,
      model,
      data,
      variable_splits,
      processes,
      verbose=True,
  ):
      """
      Inner function that calculates ceteris paribus for all variables.
  
      :param explainer:
      :param data: new observations
      :param variable_splits: dictionary of split points
      :return: ceteris paribus profile for all variable
      """
  
      if processes == 1:
          profile = []
          for variable in tqdm(
              variable_splits,
              desc="Calculating ceteris paribus",
              disable=not verbose,
          ):
              split_points = variable_splits[variable]
              profile.append(
                  single_variable_profile(
                      predict_function,
                      model,
                      data,
                      variable,
                      split_points,
                  )
              )
      else:
          pool = mp.get_context("spawn").Pool(processes)
  
          profile = pool.starmap_async(
              single_variable_profile,
              [
                  (
                      predict_function,
                      model,
                      data,
                      variable,
                      split_points,
                  )
                  for variable, split_points in variable_splits.items()
              ],
          ).get()
          pool.close()
  
      profiles = pd.concat(profile)
      # convert the variable types
      if LooseVersion(pd.__version__) >= LooseVersion("1.2.0"):
          # convert_floating=False since pandas v1.2 seem to have issues
          profiles.loc[:, list(variable_splits)] = profiles.loc[
              :, list(variable_splits)
          ].convert_dtypes(convert_floating=False)
      else:
          profiles.loc[:, list(variable_splits)] = profiles.loc[
              :, list(variable_splits)
          ].convert_dtypes()
  
      return profiles
  
file_path: DALEX/python/dalex/dalex/predict_explanations/_ceteris_paribus/utils.py
imports: import multiprocessing
  from distutils.version import LooseVersion
  import numpy
  import pandas
  from tqdm import tqdm
label_desc: Use image node_id 2 for calling a global function with example usage: calculate_variable_profile(predict_function, model, data, variable_splits, processes, verbose) and returns: profiles