varying_args.model_spec: Determine varying arguments

Description Usage Arguments Details Value Examples

View source: R/varying.R

Description

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.

Usage

1
2
3
4
5
6
7
8
## S3 method for class 'model_spec'
varying_args(object, full = TRUE, ...)

## S3 method for class 'recipe'
varying_args(object, full = TRUE, ...)

## S3 method for class 'step'
varying_args(object, full = TRUE, ...)

Arguments

object

A model_spec or a recipe.

full

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

...

Not currently used.

Details

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.

Value

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).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# List all possible varying args for the random forest spec
rand_forest() %>% varying_args()

# mtry is now recognized as varying
rand_forest(mtry = varying()) %>% varying_args()

# Even engine specific arguments can vary
rand_forest() %>%
  set_engine("ranger", sample.fraction = varying()) %>%
  varying_args()

# List only the arguments that actually vary
rand_forest() %>%
  set_engine("ranger", sample.fraction = varying()) %>%
  varying_args(full = FALSE)

rand_forest() %>%
  set_engine(
    "randomForest",
    strata = Class,
    sampsize = varying()
  ) %>%
  varying_args()

parsnip documentation built on July 8, 2020, 7:22 p.m.