Plot variable importance scores for the predictors in a model.

plot_vi(vi)

Arguments

vi

Data frame containing the variable importance scores as returned by get_vi.

Value

ggplot object showing the variable importance scores in vi.

Examples

if (FALSE) { data('mtpl_be') features <- setdiff(names(mtpl_be), c('id', 'nclaims', 'expo', 'long', 'lat')) set.seed(12345) gbm_fit <- gbm::gbm(as.formula(paste('nclaims ~', paste(features, collapse = ' + '))), distribution = 'poisson', data = mtpl_be, n.trees = 50, interaction.depth = 3, shrinkage = 0.1) gbm_fit %>% get_vi %>% plot_vi gbm_fit %>% get_vi(scale = TRUE) %>% plot_vi gbm_fit %>% get_vi %>% dplyr::mutate(Importance = Importance / 100) %>% plot_vi + scale_y_continuous(labels = scales::percent) }