Tried to check_model using a very simple glmnet classification task.
Taken some Code from here: Extract plain model from tidymodel object
library(magrittr)
library(tidymodels)
library(performance)
data(two_class_dat)
glm_spec <- logistic_reg() %>%
set_engine("glmnet")
norm_rec <- recipe(Class ~ A + B, data = two_class_dat) %>%
step_normalize(all_predictors())
glm_fit <- workflow() %>%
add_recipe(norm_rec) %>%
add_model(glm_spec) %>%
fit(two_class_dat) %>%
pull_workflow_fit()
performance::check_model(glm_fit)
Error: $ operator is invalid for atomic vectors
performance::check_model()
is a generic function. This means that specific functions (called the methods) need to be written forcheck_model()
to work on different types of objects. I think that they would need to write a method for workflow objects.In your example, you probably wouldn't want to run
check_model()
on the fitted model since it doesn't know about the pre-processing in your recipe.It looks like this SO question was converted to an issue here.