code: def calc_inv_contrib_ct(x_contrib, encoding, agg_columns):
      """
      Reversed contribution when ColumnTransformer is used.
  
      As columns transformers output hstack the result of transformers, if the TOP-preprocessed data are re-ordered
      after the ColumnTransformer the inverse transform must return false result.
  
      Parameters
      ----------
      x_contrib : pandas.DataFrame
          Contributions set.
      encoding : ColumnTransformer, list, dict
          The processing apply to the original data.
      agg_columns : str (default: 'sum')
          Type of aggregation performed. For Shap we want so sum contributions of one hot encoded variables.
  
      Returns
      -------
      pandas.Dataframe
          The aggregate contributions depending on which processing is apply.
      """
  
      if str(type(encoding)) == columntransformer:
          # We use inverse tranform from the encoding method base on columns position
          init = 0
          rst = pd.DataFrame()
  
          for enc in encoding.transformers_:
              name_encoding = enc[0]
              ct_encoding = enc[1]
              col_encoding = enc[2]
  
              if (
                  str(type(ct_encoding))
                  in supported_category_encoder + supported_sklearn
              ):
                  # We create new columns names depending on the name of the transformers and the name of the column.
                  colname_output = [
                      name_encoding + "_" + val for val in col_encoding
                  ]
  
                  # If the processing create multiple columns we find the number of original categories and aggregate
                  # the contribution.
                  if (
                      str(type(ct_encoding)) in dummies_sklearn
                      or str(type(ct_encoding))
                      in dummies_category_encoder
                  ):
                      for i_enc in range(len(colname_output)):
                          if str(type(ct_encoding)) == sklearn_onehot:
                              col_origin = ct_encoding.categories_[
                                  i_enc
                              ]
                          elif (
                              str(type(ct_encoding))
                              == category_encoder_binary
                          ):
                              try:
                                  col_origin = (
                                      ct_encoding.base_n_encoder.mapping[
                                          i_enc
                                      ]
                                      .get("mapping")
                                      .columns.tolist()
                                  )
                              except:
                                  col_origin = (
                                      ct_encoding.mapping[i_enc]
                                      .get("mapping")
                                      .columns.tolist()
                                  )
                          else:
                              col_origin = (
                                  ct_encoding.mapping[i_enc]
                                  .get("mapping")
                                  .columns.tolist()
                              )
                          nb_col = len(col_origin)
                          if agg_columns == "first":
                              contrib_inverse = x_contrib.iloc[:, init]
                          else:
                              contrib_inverse = x_contrib.iloc[
                                  :, init : init + nb_col
                              ].sum(axis=1)
                          frame = pd.DataFrame(
                              contrib_inverse,
                              columns=[colname_output[i_enc]],
                              index=contrib_inverse.index,
                          )
                          rst = pd.concat([rst, frame], axis=1)
                          init += nb_col
                  else:
                      nb_col = len(colname_output)
                      frame = x_contrib.iloc[:, init : init + nb_col]
                      frame.columns = colname_output
                      rst = pd.concat([rst, frame], axis=1)
                      init += nb_col
  
              elif name_encoding == "remainder":
                  if ct_encoding == "passthrough":
                      nb_col = len(col_encoding)
                      frame = x_contrib.iloc[:, init : init + nb_col]
                      rst = pd.concat([rst, frame], axis=1)
                      init += nb_col
              else:
                  raise Exception(
                      f"{encoding.__class__.__name__} not supported, no inverse done."
                  )
          return rst
      else:
          return x_contrib
  
file_path: shapash/shapash/utils/columntransformer_backend.py
imports: import pandas
  import numpy
  from shapash.utils.category_encoder_backend import inv_transform_ordinal
  from shapash.utils.category_encoder_backend import inv_transform_ce
  from shapash.utils.category_encoder_backend import supported_category_encoder
  from shapash.utils.category_encoder_backend import dummies_category_encoder
  from shapash.utils.category_encoder_backend import category_encoder_binary
  from shapash.utils.category_encoder_backend import transform_ordinal, get_col_mapping_ce
  from shapash.utils.model_synoptic import simple_tree_model_sklearn, catboost_model, linear_model, svm_model, xgboost_model, lightgbm_model, dict_model_feature
  from shapash.utils.model import extract_features_model
label_desc: Use image node_id 4 for calling a global function with example usage: calc_inv_contrib_ct(x_contrib, encoding, agg_columns) and returns: rst, x_contrib