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

Feature Request: get_best_model_parameters #171

Open
jkylearmstrong opened this issue Feb 7, 2025 · 0 comments
Open

Feature Request: get_best_model_parameters #171

jkylearmstrong opened this issue Feb 7, 2025 · 0 comments

Comments

@jkylearmstrong
Copy link

Wondering if you would be interested in adding something like this:

get_best_model_parameters <- function(workflowset_results, rank_metic){
  best_model <- workflowset_results %>% 
    rank_results(rank_metric = rank_metic, select_best = T) %>% 
    filter(.metric == rank_metic) %>% 
    filter(rank == 1)

  workflowset_results %>%
    filter(wflow_id == best_model$wflow_id) %>%
    select(wflow_id, info) %>%
    tidyr::unnest(info) %>%
    select(wflow_id, preproc, model) %>%
    bind_cols(
      workflowset_results %>%
        extract_workflow_set_result(id = best_model$wflow_id) %>%
        select_best(metric = rank_metic) %>%
        select(-.config)
      )
}

In other words, a way to figure out what the best model hyperparameters are. Although as I think about this, maybe even a more general method for finding model parameters:

get_model_parameters <- function(workflowset_results, rank_metic, select_best =T, rank = 1){
  best_model <- workflowset_results %>% 
    rank_results(rank_metric = rank_metic, select_best = select_best ) %>% 
    filter(.metric == rank_metic) %>% 
    filter(rank == 1)

  workflowset_results %>%
    filter(wflow_id == best_model$wflow_id) %>%
    select(wflow_id, info) %>%
    tidyr::unnest(info) %>%
    select(wflow_id, preproc, model) %>%
    bind_cols(
      workflowset_results %>%
        extract_workflow_set_result(id = best_model$wflow_id) %>%
        select_best(metric = rank_metic) %>%
        select(-.config)
      )
}

Then it defaults to giving the best model parameters, however, the user is able to select other models?

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

1 participant