code: def plot_regression_categorical(
      X, *, target_col, types=None, drop_outliers=True, **kwargs
  ):
      """Plots for categorical features in regression.
  
      Creates box plots of target distribution for important categorical
      features. Relevant features are identified using mutual information.
  
      For high cardinality categorical variables (variables with many categories)
      only the most frequent categories are shown.
  
      Parameters
      ----------
      X : dataframe
          Input data including features and target.
      target_col : str or int
          Identifier of the target column in X.
      types : dataframe of types, optional
          Output of detect_types on X. Can be used to avoid recomputing the
          types.
      drop_outliers : bool, default=True
          Whether to drop outliers (in the target column) when plotting.
      """
      types = _check_X_target_col(
          X, target_col, types, task="regression"
      )
  
      if drop_outliers:
          inliers = _find_inliers(X.loc[:, target_col])
          X = X.loc[inliers, :]
      # drop nans from target column
      if np.isnan(X[target_col]).any():
          X = X.dropna(subset=[target_col])
          warn(
              "Missing values in target_col have been removed for regression",
              UserWarning,
          )
  
      if types is None:
          types = detect_types(X)
      features = X.loc[
          :, types.categorical + types.low_card_int_categorical
      ]
      if target_col in features.columns:
          features = features.drop(target_col, axis=1)
      if features.shape[1] == 0:
          return
      features = features.astype("category")
      show_top = _get_n_top(features, "categorical")
  
      # can't use OrdinalEncoder because we might have mix of int and string
      ordinal_encoded = features.apply(lambda x: x.cat.codes)
      target = X[target_col]
      f = mutual_info_regression(
          ordinal_encoded,
          target,
          discrete_features=np.ones(X.shape[1], dtype=bool),
      )
      top_k = np.argsort(f)[-show_top:][::-1]
  
      # large number of categories -> taller plot
      row_height = 3 if X.nunique().max() <= 5 else 5
      fig, axes = _make_subplots(
          n_plots=show_top, row_height=row_height, sharex=True
      )
      plt.suptitle("Categorical Feature vs Target")
      for i, (col_ind, ax) in enumerate(zip(top_k, axes.ravel())):
          col = features.columns[i]
          X_new = _prune_category_make_X(X, col, target_col)
          medians = X_new.groupby(col)[target_col].median()
          order = medians.sort_values().index
          sns.boxplot(
              x=target_col, y=col, data=X_new, order=order, ax=ax
          )
          ax.set_title("F={:.2E}".format(f[col_ind]))
          # shorten long ticks and labels
          _short_tick_names(ax, label_length=row_height * 12)
          _apply_eng_formatter(ax, which="x")
  
      for j in range(i + 1, axes.size):
          # turn off axis if we didn't fill last row
          axes.ravel()[j].set_axis_off()
      return axes
  
imports: import warnings
  import numpy
  import matplotlib.pyplot
  import matplotlib
  import seaborn
  import pandas
  from sklearn.feature_selection import mutual_info_regression, mutual_info_classif, f_classif
  from sklearn.impute import SimpleImputer
  from sklearn.preprocessing import scale
  from sklearn.decomposition import PCA
  from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
  from sklearn.metrics import recall_score
  from ..preprocessing import detect_types, clean
  from .utils import _check_X_target_col, _get_n_top, _make_subplots, _short_tick_names, _shortname, _prune_category_make_X, find_pretty_grid, _find_scatter_plots_classification, class_hists, discrete_scatter, mosaic_plot, _find_inliers, pairplot, _get_scatter_alpha, _get_scatter_size, _find_categorical_for_regression, _prune_categories, _apply_eng_formatter
  from .sankey import plot_sankey
  from warnings import warn
label_desc: Use image node_id 2 for calling a global function with example usage: plot_regression_categorical(X) and returns: axes