Various plotting functions to visualize feature importances. `plot_feature_importances` creates bar plots of the feature importances across different models. `plot_feature_importance_pair` create pair plots, comparing the feature importances between all pairs of models. `plot_feature_importance_stability` creates boxplots of the distribution of feature importances across the many data perturbations for each model.

plot_feature_importance(
  data,
  feature_col = "Variable",
  importance_col = "Importance",
  model_col = "Method",
  max_features = 50,
  use_rankings = FALSE,
  use_facets = TRUE,
  interactive = FALSE,
  ...
)

plot_feature_importance_pair(
  data,
  feature_col = "Variable",
  importance_col = "Importance",
  model_col = "Method",
  use_rankings = FALSE,
  interactive = FALSE,
  ...
)

plot_feature_importance_stability(
  data,
  feature_col = "Variable",
  importance_col = "Importance",
  model_col = "Method",
  max_features = 50,
  use_rankings = FALSE,
  use_facets = TRUE,
  interactive = FALSE,
  ...
)

Arguments

data

A data frame with the feature importance information. At a minimum, this data frame should contain columns with the names specified by `feature_col`, `importance_col`, and `model_col`.

feature_col

Character string. Name of the column in `data` with the feature names.

importance_col

Character string. Name of the column in `data` with the feature importance scores.

model_col

Character string. Name of the column in `data` with the model names.

max_features

Maximum number of features to display in the plot.

use_rankings

Logical indicating whether or not to use the feature importance rankings, rather than the raw feature importance scores, for plotting.

use_facets

Logical indicating whether or not to use faceting to separate the feature importances by model.

interactive

Logical indicating whether or not to return an interactive plot.

...

Additional arguments to pass to `plot_pairs()`. Only used in `plot_feature_importance_pair()`.

Value

If `interactive = FALSE`, returns a ggplot object. If `interactive = TRUE`, returns an interactive plotly object.