Skip to content

Name translations #735

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jun 6, 2022
Merged

Name translations #735

merged 8 commits into from
Jun 6, 2022

Conversation

topepo
Copy link
Member

@topepo topepo commented May 26, 2022

Developer function to list names of tuning parameters

library(parsnip)
spec <- boost_tree(trees = tune("number of trees"), min_n = tune(), tree_depth = 3)

.model_param_name_key(spec)
#> # A tibble: 2 × 3
#>   user            parsnip engine          
#>   <chr>           <chr>   <chr>           
#> 1 number of trees trees   nrounds         
#> 2 min_n           min_n   min_child_weight

# A version to use with dplyr::rename()
.model_param_name_key(spec, as_tibble = FALSE)
#> $user_to_parsnip
#>             trees             min_n 
#> "number of trees"           "min_n" 
#> 
#> $parsnip_to_engine
#>          nrounds min_child_weight 
#>          "trees"          "min_n"

Created on 2022-05-26 by the reprex package (v2.0.1)

@topepo topepo requested a review from juliasilge May 26, 2022 19:16
Copy link
Member

@juliasilge juliasilge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function this PR creates isn't type stable, which we generally try to avoid. Would it be better to make two functions, .model_param_name_key_dfr() (or similar) and .model_param_name_key_list()?

@topepo
Copy link
Member Author

topepo commented Jun 6, 2022

The default value is type stable and I'm fine with that.

@topepo topepo merged commit 9b4c0b8 into main Jun 6, 2022
@topepo topepo deleted the name-translations branch June 6, 2022 17:02
@github-actions
Copy link

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.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants