tidymodels / dials

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

Remove duplicate rows from parameter grids #139

Closed juliasilge closed 4 years ago

juliasilge commented 4 years ago

This PR closes #133 and is related to tidymodels/tune#270.

library(dials)
#> Loading required package: scales

grid_latin_hypercube(
  prod_degree(),
  prune_method(),
  size = 100
)
#> # A tibble: 12 x 2
#>    prod_degree prune_method
#>          <int> <chr>       
#>  1           2 seqrep      
#>  2           1 backward    
#>  3           2 cv          
#>  4           1 cv          
#>  5           1 none        
#>  6           2 forward     
#>  7           2 none        
#>  8           1 seqrep      
#>  9           1 exhaustive  
#> 10           2 backward    
#> 11           1 forward     
#> 12           2 exhaustive

Created on 2020-09-04 by the reprex package (v0.3.0.9001)

Here in dials, this PR currently does not issue a warning that fewer rows are returned that were specified (this is different behavior than in tune). I noticed that this is the existing behavior for grid_regular() so I matched it:

This also means that if n is larger than the range of the integers, a smaller set will be generated.

We can definitely generate a warning, but then folks will get a warning in one situation and not in others. I do think we should add something in the documentation, probably to the size argument. Sound good?

github-actions[bot] commented 3 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.