Compute variable importance scores for the predictors in a model.
vi(object, ...) # S3 method for default vi( object, method = c("model", "pdp", "ice", "permute", "shap"), feature_names = NULL, FUN = NULL, var_fun = NULL, abbreviate_feature_names = NULL, sort = TRUE, decreasing = TRUE, scale = FALSE, rank = FALSE, ... ) # S3 method for model_fit vi(object, ...)
object  A fitted model object (e.g., a 

...  Additional optional arguments to be passed onto

method  Character string specifying the type of variable importance
(VI) to compute. Current options are 
feature_names  Character string giving the names of the predictor variables (i.e., features) of interest. 
FUN  Deprecated. Use 
var_fun  List with two components, 
abbreviate_feature_names  Integer specifying the length at which to
abbreviate feature names. Default is 
sort  Logical indicating whether or not to order the sort the variable
importance scores. Default is 
decreasing  Logical indicating whether or not the variable importance
scores should be sorted in descending ( 
scale  Logical indicating whether or not to scale the variable
importance scores so that the largest is 100. Default is 
rank  Logical indicating whether or not to rank the variable
importance scores (i.e., convert to integer ranks). Default is 
A tidy data frame (i.e., a "tibble"
object) with at least two
columns: Variable
and Importance
. For "lm"/"glm"
like
objects, an additional column, called Sign
, is also included which
includes the sign (i.e., POS/NEG) of the original coefficient. If
method = "permute"
and nsim > 1
, then an additional column,
StDev
, giving the standard deviation of the permutationbased
variable importance scores is included.
Greenwell, B. M., Boehmke, B. C., and McCarthy, A. J. A Simple and Effective ModelBased Variable Importance Measure. arXiv preprint arXiv:1805.04755 (2018).
# # A projection pursuit regression example # # Load the sample data data(mtcars) # Fit a projection pursuit regression model mtcars.ppr < ppr(mpg ~ ., data = mtcars, nterms = 1) # Compute variable importance scores vi(mtcars.ppr, method = "ice")#> # A tibble: 10 x 2 #> Variable Importance #> <chr> <dbl> #> 1 wt 3.44 #> 2 hp 2.57 #> 3 gear 1.85 #> 4 qsec 1.56 #> 5 cyl 0.743 #> 6 am 0.690 #> 7 vs 0.448 #> 8 drat 0.245 #> 9 carb 0.0870 #> 10 disp 0.0248#> # A tibble: 10 x 2 #> Variable Importance #> <chr> <dbl> #> 1 wt 3.87 #> 2 hp 2.85 #> 3 gear 2.14 #> 4 qsec 1.71 #> 5 cyl 0.949 #> 6 am 0.723 #> 7 vs 0.470 #> 8 drat 0.297 #> 9 carb 0.102 #> 10 disp 0.0317