plot_feature_importance

plot_feature_importance#

mlproject.plotting.importances.plot_feature_importance(feat_imp_df, target_name, figsize=(14, 10), title_fontsize=18, tick_label_fontsize=14, n_feats=20, lob_color='#a6cee3', default_color='#fdbf6f', importance_type='Permutation', model_name='MODNet', include_err_bars=False)[source]#

Plot feature importances from a DataFrame.

Parameters:
  • feat_imp_df (pd.DataFrame) – DataFrame with feature importances. Must contain ‘mean’ and ‘std’ columns.

  • target_name (str) – Name of the target variable.

  • figsize (tuple) – Figure size.

  • title_fontsize (int) – Font size for the title.

  • tick_label_fontsize (int) – Font size for the tick labels.

  • n_feats (int) – Number of top features to plot.

  • lob_color (str) – Color for lobster features.

  • default_color (str) – Color for other features.

  • importance_type (str) – Type of feature importance (e.g., “Permutation”, “SHAP”).

  • model_name (str) – Name of the model.

  • include_err_bars (bool) – Whether to include error bars.

Returns:

The matplotlib figure object.

Return type:

plt.Figure