varying_args()
takes a model specification or a recipe and returns a tibble
of information on all possible varying arguments and whether or not they
are actually varying.
# S3 method for model_spec varying_args(object, full = TRUE, ...) # S3 method for recipe varying_args(object, full = TRUE, ...) # S3 method for step varying_args(object, full = TRUE, ...)
object | A |
---|---|
full | A single logical. Should all possible varying parameters be
returned? If |
... | Not currently used. |
A tibble with columns for the parameter name (name
), whether it
contains any varying value (varying
), the id
for the object (id
),
and the class that was used to call the method (type
).
The id
column is determined differently depending on whether a model_spec
or a recipe
is used. For a model_spec
, the first class is used. For
a recipe
, the unique step id
is used.
#> # A tibble: 3 x 4 #> name varying id type #> <chr> <lgl> <chr> <chr> #> 1 mtry FALSE rand_forest model_spec #> 2 trees FALSE rand_forest model_spec #> 3 min_n FALSE rand_forest model_spec#> # A tibble: 3 x 4 #> name varying id type #> <chr> <lgl> <chr> <chr> #> 1 mtry TRUE rand_forest model_spec #> 2 trees FALSE rand_forest model_spec #> 3 min_n FALSE rand_forest model_spec# Even engine specific arguments can vary rand_forest() %>% set_engine("ranger", sample.fraction = varying()) %>% varying_args()#> # A tibble: 4 x 4 #> name varying id type #> <chr> <lgl> <chr> <chr> #> 1 mtry FALSE rand_forest model_spec #> 2 trees FALSE rand_forest model_spec #> 3 min_n FALSE rand_forest model_spec #> 4 sample.fraction TRUE rand_forest model_spec# List only the arguments that actually vary rand_forest() %>% set_engine("ranger", sample.fraction = varying()) %>% varying_args(full = FALSE)#> # A tibble: 1 x 4 #> name varying id type #> <chr> <lgl> <chr> <chr> #> 1 sample.fraction TRUE rand_forest model_specrand_forest() %>% set_engine( "randomForest", strata = Class, sampsize = varying() ) %>% varying_args()#> # A tibble: 5 x 4 #> name varying id type #> <chr> <lgl> <chr> <chr> #> 1 mtry FALSE rand_forest model_spec #> 2 trees FALSE rand_forest model_spec #> 3 min_n FALSE rand_forest model_spec #> 4 strata FALSE rand_forest model_spec #> 5 sampsize TRUE rand_forest model_spec