tidymodels / dials

Tools for creating tuning parameter values
https://dials.tidymodels.org/
Other
111 stars 26 forks source link

workshop `print.parameters` #231

Closed simonpcouch closed 2 years ago

simonpcouch commented 2 years ago

Closes #230. 🦆

Examples of old output:

# install.packages("dials")

library(parsnip)

boost_tree() %>%
  set_engine("C5.0", trials = tune()) %>%
  extract_parameter_set_dials()
#> Collection of 1 parameters for tuning
#> 
#>  identifier   type object
#>      trials trials    lgl
#> Warning: Unknown or uninitialised column: `identifier`.
#> One needs a `param` object: ''

boost_tree() %>%
  set_engine("C5.0", trials = tune(), rules = tune()) %>%
  extract_parameter_set_dials()
#> Collection of 2 parameters for tuning
#> 
#>  identifier   type object
#>      trials trials    lgl
#>       rules  rules    lgl
#> Warning: Unknown or uninitialised column: `identifier`.
#> Several need `param` objects:  ''

boost_tree() %>%
  set_engine("C5.0", trials = tune(), rules = tune(), costs = tune()) %>%
  extract_parameter_set_dials()
#> Collection of 3 parameters for tuning
#> 
#>  identifier   type object
#>      trials trials    lgl
#>       rules  rules    lgl
#>       costs  costs    lgl
#> Warning: Unknown or uninitialised column: `identifier`.
#> Several need `param` objects:  ''

Examples of new output:

# devtools::install_github("tidymodels/dials@prompting-230")

library(parsnip)

boost_tree() %>%
  set_engine("C5.0", trials = tune()) %>%
  extract_parameter_set_dials()
#> Collection of 1 parameters for tuning
#> 
#>  identifier   type  object
#>      trials trials missing
#> The parameter `trials` needs a `param` object. 
#> See `vignette('dials')` to learn more.

boost_tree() %>%
  set_engine("C5.0", trials = tune(), rules = tune()) %>%
  extract_parameter_set_dials()
#> Collection of 2 parameters for tuning
#> 
#>  identifier   type  object
#>      trials trials missing
#>       rules  rules missing
#> The parameters `trials` and `rules` need `param` objects. 
#> See `vignette('dials')` to learn more.

boost_tree() %>%
  set_engine("C5.0", trials = tune(), rules = tune(), costs = tune()) %>%
  extract_parameter_set_dials()
#> Collection of 3 parameters for tuning
#> 
#>  identifier   type  object
#>      trials trials missing
#>       rules  rules missing
#>       costs  costs missing
#> The parameters `trials`, `rules`, and `costs` need `param` objects. 
#> See `vignette('dials')` to learn more.

Will self-review to point out a couple of things I’d appreciate an eye for.

Created on 2022-04-24 by the reprex package (v2.0.1)

github-actions[bot] commented 2 years ago

This pull request has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.