I was following the guide here https://www.tidymodels.org/start/tuning/ on tuning models using tidymodels but wanted to try it using a bagged tree model. However, when I try and tune the bagged tree model I get the warning message:
Warning message: All models failed in tune_grid(). See the .notes column.
In the notes column each entry is:
"internal: Error in rlang::env_get(mod_env, items): argument \"default\" is missing, with no default"
The only thing different about my code from the guide is the model type and the model will fit if I specify the parameters directly, but I am unable to tune the model and I'm not sure why. Nor can I find any posts of others having a similar problem with baguette or rpart using tune_grid.
library(baguette)
bag_spec <-
bag_tree(tree_depth = tune()) %>%
set_mode("regression") %>%
set_engine("rpart", times = 25)
bag_grid <- grid_regular(
tree_depth(),
levels = 10
)
bag_wf <- workflow() %>%
add_formula(QUAL_SCORE_y0 ~ .) %>%
add_model(bag_spec)
vb_folds <- vfold_cv(df_training)
doParallel::registerDoParallel()
bag_res <- tune_grid(
bag_wf,
resamples = vb_folds,
grid = bag_grid
)