Variable importance
Compute variable importance scores for the predictors in a model.
vi(object, ...) ## Default S3 method: vi( object, method = c("model", "firm", "permute", "shap"), feature_names = NULL, FUN = NULL, var_fun = NULL, ice = FALSE, abbreviate_feature_names = NULL, sort = TRUE, decreasing = TRUE, scale = FALSE, rank = FALSE, ... ) ## S3 method for class 'model_fit' vi(object, ...) ## S3 method for class 'WrappedModel' vi(object, ...) ## S3 method for class 'Learner' vi(object, ...)
object |
A fitted model object (e.g., a |
... |
Additional optional arguments to be passed on to
|
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, |
ice |
Logical indicating whether or not to estimate feature effects
using individual conditional expectation (ICE) curves.
Only applies when |
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 permutation-based
variable importance scores is included.
Greenwell, B. M., Boehmke, B. C., and McCarthy, A. J. A Simple and Effective Model-Based 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 = "firm", ice = TRUE) vi(mtcars.ppr, method = "firm", ice = TRUE, var_fun = list("con" = mad, "cat" = function(x) diff(range(x)) / 4)) # Plot variable importance scores vip(mtcars.ppr, method = "firm", ice = TRUE)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.