tune_args() takes a model specification or a recipe and returns a tibble of information on all possible tunable arguments and whether or not they are actually tunable.

tune_args(object, ...)

# S3 method for model_spec
tune_args(object, full = FALSE, ...)

# S3 method for recipe
tune_args(object, full = FALSE, ...)

# S3 method for step
tune_args(object, full = FALSE, ...)

# S3 method for check
tune_args(object, full = FALSE, ...)

# S3 method for workflow
tune_args(object, ...)

Arguments

object

A model_spec, recipe, workflow or other object.

...

Not currently used.

full

A single logical. Should all possible tunable parameters be returned? If FALSE, then only the parameters that are actually tunable are returned.

Value

A tibble with columns for the parameter name (name), whether it contains any tunable value (tune), the id for the parameter (id), and the information on where the parameter was located (source).

Details

The source column is determined differently depending on whether a model_spec or a recipe is used (with additional detail on the type).

The id field has any identifier that was passed to tune() (e.g. tune("some note")). If not additional detail was used in that function, the id field reverts to the name of the parameters.

Examples

# \donttest{ library(recipes) recipe(mpg ~ ., data = mtcars) %>% step_knnimpute(all_predictors(), neighbors = tune()) %>% step_pca(all_predictors(), num_comp = tune()) %>% tune_args()
#> # A tibble: 2 x 6 #> name tunable id source component component_id #> <chr> <lgl> <chr> <chr> <chr> <chr> #> 1 neighbors TRUE neighbors recipe step_knnimpute knnimpute_t9HFq #> 2 num_comp TRUE num_comp recipe step_pca pca_Bnj5i
recipe(mpg ~ ., data = mtcars) %>% step_ns(disp, deg_free = tune("disp df")) %>% step_ns(wt, deg_free = tune("wt df")) %>% tune_args()
#> # A tibble: 2 x 6 #> name tunable id source component component_id #> <chr> <lgl> <chr> <chr> <chr> <chr> #> 1 deg_free TRUE disp df recipe step_ns ns_g5kPF #> 2 deg_free TRUE wt df recipe step_ns ns_nayuJ
recipe(mpg ~ ., data = mtcars) %>% step_normalize(all_predictors()) %>% tune_args()
#> # A tibble: 0 x 6 #> # … with 6 variables: name <chr>, tunable <lgl>, id <chr>, source <chr>, #> # component <chr>, component_id <chr>
library(parsnip) boost_tree(trees = tune(), min_n = tune()) %>% set_engine("xgboost") %>% tune_args()
#> # A tibble: 2 x 6 #> name tunable id source component component_id #> <chr> <lgl> <chr> <chr> <chr> <chr> #> 1 trees TRUE trees model_spec boost_tree NA #> 2 min_n TRUE min_n model_spec boost_tree NA
boost_tree(trees = tune(), min_n = tune()) %>% set_engine("C5.0", rules = TRUE) %>% tune_args()
#> # A tibble: 2 x 6 #> name tunable id source component component_id #> <chr> <lgl> <chr> <chr> <chr> <chr> #> 1 trees TRUE trees model_spec boost_tree NA #> 2 min_n TRUE min_n model_spec boost_tree NA
# }