tidymodels, how to set verbosity when fitting a workflow

tidymodels, how to set verbosity when fitting a workflow

myModel<- workflow() %>%
add_model(model_spec) %>%
add_recipe(recipe_spec) %>%
fit(df_train,verbosity=0) <-does not work

does not work too:
parsnip::fit(df_train,control_workflow(control_parsnip=control_parsnip(verbosity=0)))

Sorry that this is confusing.

verbosity is not an argument to fit.workflow() so that shouldn't work. Here is the help page.

To set the verbosity of the model, you can quiet the results using control_parsnip() (as you show). Since this isn't a reproducible example, we can't tell what went wrong for your data/models, but here is an example where it does work:

library(tidymodels)
tidymodels_prefer()
data("Sacramento")

chatty <- 
  mlp() %>% 
  set_engine("nnet", trace = TRUE) %>% 
  set_mode("regression")

nn_wflow <- 
  workflow() %>%
  add_formula(price ~ type + sqft + beds + baths) %>% 
  add_model(chatty)

set.seed(1)
nn_fit <- fit(nn_wflow, Sacramento)
#> # weights:  36
#> initial  value 72712505768277.218750 
#> final  value 16007850421474.472656 
#> converged

model_ctrl <- control_parsnip(verbosity = 0L)
set.seed(1)
nn_fit_check <- fit(nn_wflow, Sacramento, control = control_workflow(model_ctrl))

Created on 2022-01-31 by the reprex package (v2.0.1)

1 Like

Thx... works fine, I guess.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.