I need a function to use in a Workflow of the importance of variables that returns something similar to %IncMSE, I used a function from the VIP
package but it only returns the plot, I want the column name format and its importance on the side. Below is the format I need for the output: https://i.stack.imgur.com/62dau.png
Asked
Active
Viewed 57 times
-1

desertnaut
- 57,590
- 26
- 140
- 166
1 Answers
3
You could use the function vi
form vip
:
Compute variable importance scores for the predictors in a model.
Here a reproducible example:
library(tidymodels)
library(mlbench)
library(vip)
library(rpart)
set.seed(101)
trn <- as.data.frame(mlbench::mlbench.friedman1(500))
tree <- rpart(y ~ ., data = trn)
vi(tree)
#> # A tibble: 10 × 2
#> Variable Importance
#> <chr> <dbl>
#> 1 x.4 4234.
#> 2 x.2 2513.
#> 3 x.1 2461.
#> 4 x.5 1230.
#> 5 x.3 688.
#> 6 x.6 533.
#> 7 x.7 357.
#> 8 x.9 331.
#> 9 x.8 276.
#> 10 x.10 275.
Created on 2022-07-17 by the reprex package (v2.0.1)

Quinten
- 35,235
- 5
- 20
- 53