autoplot.importance_perm.Rd
Visualize importance scores
# S3 method for class 'importance_perm'
autoplot(
object,
top = Inf,
metric = NULL,
eval_time = NULL,
type = "importance",
...
)
A tibble of results from importance_perm()
.
An integer for how many terms to show. To define importance when there are multiple metrics, the rankings of predictors are computed across metrics and the average rank is used. In the case of tied rankings, all the ties are included.
A character vector or NULL
for which metric to plot. By
default, all metrics will be shown via facets. Possible options are
the entries in .metric
column of the object.
For censored regression models, a vector of time points at which the survival probability is estimated.
A character value. The default is "importance"
which shows the
overall signal-to-noise ration (i.e., mean divided by standard error).
Alternatively, "difference"
shows the mean difference value with standard
error bounds.
Not used.
A ggplot2
object.
if (!rlang::is_installed(c("modeldata", "recipes", "workflows"))) {
library(modeldata)
library(recipes)
library(workflows)
library(dplyr)
data(ad_data, package = "modeldata")
ad_rec <-
recipe(Class ~ ., data = ad_data) %>%
step_pca(all_numeric_predictors(), -male, -age, num_comp = 5) %>%
step_dummy(all_factor_predictors()) %>%
step_zv(all_predictors())
ad_wflow <- workflow(ad_rec, logistic_reg())
ad_fit <- fit(ad_wflow, data = ad_data)
###
set.seed(392)
imp_orig <- importance_perm(ad_fit, data = ad_data, type = "original")
autoplot(imp_derv, top = 10)
###
set.seed(392)
imp_derv <- importance_perm(ad_fit, data = ad_data, type = "derived")
autoplot(imp_derv)
autoplot(imp_derv, metric = "brier_class", type = "difference")
}