code: def get_transformed_X(
      transformer_pipeline: Pipeline, X: pd.DataFrame, verbose: int = 1
  ):
      """takes a transformer_pipeline (all the steps except the final Estimator of an sklearn or imblearn Pipeline)
      and uses it to transform input DataFrame X and returns a transformed DataFrame.
  
      If all steps have .get_feature_names_out() method implemented, then uses that to assign column names.
      If not and the number of columns stays equal, simply assign the old column names.
      Else assign column names 'col1', 'col2', etc...
  
      Args:
          transformer_pipeline: transformer part of a Pipeline, generated with split_pipeline()
          X: input DataFrame to be transformed
  
      Returns:
          X_transformed: transformed dataframe with column names assigned
      """
      X_transformed = transformer_pipeline.transform(X)
  
      if hasattr(transformer_pipeline, "get_feature_names_out"):
          try:
              columns = list(
                  transformer_pipeline.get_feature_names_out()
              )
              if len(columns) != X_transformed.shape[1]:
                  raise ValueError(
                      f"len(pipeline[:-1].get_feature_names_out())={len(columns)} does"
                      f" not equal X_transformed.shape[1]={X_transformed.shape[1]}!"
                  )
              return pd.DataFrame(X_transformed, columns=columns)
          except:
              if verbose:
                  print(
                      "Failed to retrieve new column names from transformer_pipeline.get_feature_names_out()!"
                  )
  
      if X_transformed.shape == X.values.shape:
          if verbose:
              print(
                  "transformer pipeline outputs a DataFrame with the same number of columns"
                  f"so trying to assign column names from X.columns: {X.columns.tolist()}, so"
                  " make sure that your pipeline does not add, remove or reorders columns!",
                  flush=True,
              )
          try:
              for i, pipe in enumerate(transformer_pipeline):
                  if hasattr(pipe, "n_features_in_"):
                      assert pipe.n_features_in_ == len(X.columns)
              return pd.DataFrame(X_transformed, columns=X.columns)
          except:
              print(
                  f".n_features_in_ did not match len(X.columns)={len(X.columns)} for pipeline step {i}: {pipe}!"
              )
  
      if verbose:
          print(
              "Pipeline does not have a functioning .get_feature_names_out() method, "
              "nor do all pipeline steps return the same number of columns as input, "
              "so assigning columns names 'col1', 'col2', etc instead!"
          )
      columns = [f"col{i+1}" for i in range(X_transformed.shape[1])]
  
      return pd.DataFrame(X_transformed, columns=columns)
  
imports: from functools import partial
  import re
  from collections import Counter
  from typing import List, Union
  import warnings
  import numpy
  import pandas
  from pandas.api.types import is_numeric_dtype, is_categorical_dtype
  from dtreeviz.trees import ShadowDecTree
  from sklearn.metrics import make_scorer
  from sklearn.base import clone
  from sklearn.pipeline import Pipeline
  from sklearn.model_selection import KFold, StratifiedKFold
  from joblib import Parallel, delayed
label_desc: Use image node_id 8 for calling a global function with example usage: get_transformed_X(transformer_pipeline, X, verbose) and returns: pd, pd, pd