library(parsnip)
library(rpart)
# Create model and fit
lm_fit <- linear_reg() %>%
set_engine("lm") %>%
fit(mpg ~ ., data = mtcars)
out <- butcher(lm_fit, verbose = TRUE)
# Another parsnip model
rpart_fit <- decision_tree(mode = "regression") %>%
set_engine("rpart") %>%
fit(mpg ~ ., data = mtcars, minsplit = 5, cp = 0.1)
out <- butcher(rpart_fit, verbose = TRUE)
Run the code above in your browser using DataLab