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

Highlight the default row in tuning parameters table #46

Closed
adhikars11 opened this issue Aug 12, 2021 · 2 comments
Closed

Highlight the default row in tuning parameters table #46

adhikars11 opened this issue Aug 12, 2021 · 2 comments
Labels
help wanted ❤️ we'd love your help!

Comments

@adhikars11
Copy link
Collaborator

The default configuration and the plots are based on the optimal value of the first metric. Currently, when the app is first launched, the default row is not selected/highlighted on the tuning parameters datable and we want to do that.
This seems doable but complicated. Here is a way to add a default selection to a DT table. There is also a way to initialize a reactive value (for input$metrics_rows_selected) via eventReactive().

@adhikars11 adhikars11 added the help wanted ❤️ we'd love your help! label Aug 12, 2021
@adhikars11
Copy link
Collaborator Author

I solved this issue by creating a copy of the performance table and finding the row index of the lowest value of the optimal value of the first metric which is the default metric. The following code solved the issue:

table_with_default_metric <- performance %>%
        dplyr::mutate(estimate = ifelse(metric != tune::.get_tune_metric_names(x$tune_results)[1],
                                        NA, estimate))
default_row_index <- which.min(table_with_default_metric$estimate)
output$metrics <- DT::renderDataTable({
        performance %>%
          dplyr::select(-.config) %>%
          DT::datatable(
            selection = list(mode = "single", selected = default_row_index),
            filter = "top",
            fillContainer = FALSE,
            rownames = FALSE,
            style = "bootstrap"
          ) %>%
          DT::formatSignif(columns = reals, digits = 3)
      })

@github-actions
Copy link

This issue 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 Jan 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted ❤️ we'd love your help!
Projects
None yet
Development

No branches or pull requests

1 participant