Skip to content

Instantly share code, notes, and snippets.

@bradleyboehmke
Created June 4, 2020 10:35
Show Gist options
  • Select an option

  • Save bradleyboehmke/4bcae9240bc38a8ff582ff907e0e46de to your computer and use it in GitHub Desktop.

Select an option

Save bradleyboehmke/4bcae9240bc38a8ff582ff907e0e46de to your computer and use it in GitHub Desktop.
library(parsnip)
library(vip)
m <- linear_reg() %>%
set_engine("lm") %>%
set_mode("regression") %>%
fit(mpg ~ ., data = mtcars)
vi_firm(m$fit, feature_names = setdiff(names(mtcars), "mpg"), train = mtcars)
vip(m$fit, method = "firm", feature_names = setdiff(names(mtcars), "mpg"), train = mtcars)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment