Skip to content
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

Row order of minimal grid returned by min_grid() #987

Open
hfrick opened this issue Feb 28, 2025 · 1 comment
Open

Row order of minimal grid returned by min_grid() #987

hfrick opened this issue Feb 28, 2025 · 1 comment

Comments

@hfrick
Copy link
Member

hfrick commented Feb 28, 2025

In the example below I would have expected min_grid() to return rows arranged by the non-submodel parameter min_n, instead it seems to be doing: first rows with something in .submodels, then the rest. Not sure it's worth looking into this but wanted to make a note since it's different from the behavior of tidyr::nest().

library(tune)

mod_tune <-
    parsnip::boost_tree(
        trees = tune(),
        min_n = tune(),
        mode = "regression"
    )
model_grid <- list(
  tibble::tibble(trees = 1:2, min_n = 1L),
  tibble::tibble(trees = 2L, min_n = 2L),
  tibble::tibble(trees = 2:3, min_n = 3L)
) |>
  purrr::list_rbind()

min_grid(mod_tune, model_grid)
#> # A tibble: 3 × 3
#>   trees min_n .submodels      
#>   <int> <int> <list>          
#> 1     2     1 <named list [1]>
#> 2     3     3 <named list [1]>
#> 3     2     2 <list [0]>

Created on 2025-02-28 with reprex v2.1.1

@topepo
Copy link
Member

topepo commented Mar 10, 2025

We might be able to resort afterwords.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants