code: def models_feature_importance(results_path, models):
      try:
          model_feature_imp = {}
          for m in models:
              model_path = os.path.join(results_path, m.get_name())
              imp_data = [
                  f
                  for f in os.listdir(model_path)
                  if "_importance.csv" in f and "shap" not in f
              ]
              if not len(imp_data):
                  continue
  
              df_all = []
              for fname in imp_data:
                  df = pd.read_csv(
                      os.path.join(model_path, fname), index_col=0
                  )
                  df_all += [df]
  
              df = pd.concat(df_all, axis=1)
  
              model_feature_imp[m.get_name()] = df.mean(axis=1)
  
          if len(model_feature_imp) < 2:
              # too small number of models
              return
          mfi = pd.concat(model_feature_imp, axis=1)
  
          mfi["m"] = mfi.mean(axis=1)
          mfi = mfi.sort_values(by="m", ascending=False)
          mfi = mfi.drop("m", axis=1)
  
          title = "Feature importance"
          if mfi.shape[0] > 25:
              mfi = mfi.head(25)
              title = "Top-25 important features"
  
          fig, ax = plt.subplots(1, 1, figsize=(10, 9))
  
          image = ax.imshow(
              mfi,
              interpolation="nearest",
              cmap=plt.cm.get_cmap("Blues"),
              aspect="auto",
          )
          plt.colorbar(mappable=image)
  
          x_tick_marks = np.arange(len(mfi.columns))
          y_tick_marks = np.arange(len(mfi.index))
          ax.set_xticks(x_tick_marks)
          ax.set_xticklabels(mfi.columns, rotation=90)
          ax.set_yticks(y_tick_marks)
          ax.set_yticklabels(mfi.index)
          ax.set_title(title)
  
          plt.tight_layout(pad=2.0)
          plot_path = os.path.join(
              results_path, AutoMLPlots.features_heatmap_fname
          )
          plt.savefig(plot_path)
          plt.close("all")
      except Exception as e:
          pass
  
file_path: mljar-supervised/supervised/utils/automl_plots.py
imports: import logging
  import os
  import warnings
  import numpy
  import pandas
  import scipy
  from supervised.utils.config import LOG_LEVEL
  from supervised.utils.metric import Metric
  import warnings
  import matplotlib.pyplot
label_desc: Use image node_id 2 for calling the AutoMLPlots obj's underlying member method code with example usage: obj.models_feature_importance(results_path, models) without return types