Skip to content

Commit

Permalink
Restoring enmtools.vip plots for shapley
Browse files Browse the repository at this point in the history
  • Loading branch information
danlwarren committed Aug 6, 2024
1 parent 683272b commit d8ad17c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/enmtools.vip.R
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ enmtools.vip <- function(model, metric = "roc_auc", nsim = 10, method = "permute

output[["shap.plot"]] <- ggplot(output[["shap"]],
aes_string(x = "Importance",
fill = after_stat("..x.."))) +
fill = fct_reorder("Variable", "Importance", .desc = TRUE))) +
geom_histogram(bins = 20) +
theme_bw() +
geom_hline(yintercept = 0, color = "grey") +
Expand Down Expand Up @@ -239,7 +239,7 @@ enmtools.vip <- function(model, metric = "roc_auc", nsim = 10, method = "permute
geom_histogram(bins = 20) +
theme_bw() +
geom_hline(yintercept = 0, color = "grey") +
viridis::scale_fill_viridis(name = "Variable", option = "D", discrete = TRUE, direction = -1) +
viridis::scale_fill_viridis(name = "Variable", option = "D", discrete = TRUE) +
facet_grid(rows = vars(fct_reorder(.data$Variable, .data$Importance, .desc = TRUE)), switch = "y") +
ylab("Variable") +
ggtitle("Variable importance, FIRM method") +
Expand Down

0 comments on commit d8ad17c

Please sign in to comment.