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

Tuning MLPs with h2o #882

Closed
walkerjameschris opened this issue Apr 2, 2024 · 4 comments
Closed

Tuning MLPs with h2o #882

walkerjameschris opened this issue Apr 2, 2024 · 4 comments

Comments

@walkerjameschris
Copy link

The problem

I am having trouble tuning an MLP using tune when the engine is set to "h2o". I am creating a recipe, applying it to a workflow, and tuning it over a grid of parameters. This tuning procedure works for other engines such as "nnet". The error appears to be related to performance computation:

#> x Bootstrap1: internal: Error in fn(...): unused arguments (metrics_info = list(c("rmse", "rsq")...

Reproducible example

library(tidymodels)
library(tidyr)
library(ggplot2)
library(agua)


nn_rec <-
  recipes::recipe(
    price ~ .,
    data = diamonds
  ) |>
  recipes::step_select(
    recipes::all_numeric()
  )

nn_grid <-
  tidyr::expand_grid(
    hidden_units = c(5, 10)
  )

nn_wflow <-
  parsnip::mlp(
    mode = "regression",
    engine = "h2o",
    hidden_units = tune::tune()
  ) |>
  workflows::workflow(
    preprocessor = nn_rec,
    spec = _
  )

rsample::bootstraps(
  data = diamonds,
  times = 3
) |>
  withr::with_seed(
    seed = 12345
  ) |>
  tune::tune_grid(
    object = nn_wflow,
    resamples = _,
    grid = nn_grid,
    control = tune::control_grid(verbose = TRUE)
  )
#> x Bootstrap1: internal: Error in fn(...): unused arguments (metrics_info = list(c("rmse", "rsq")...
#> x Bootstrap2: internal: Error in fn(...): unused arguments (metrics_info = list(c("rmse", "rsq")...
#> x Bootstrap3: internal: Error in fn(...): unused arguments (metrics_info = list(c("rmse", "rsq")...
#> Warning: All models failed. Run `show_notes(.Last.tune.result)` for more
#> information.
#> # Tuning results
#> # Bootstrap sampling 
#> # A tibble: 3 × 4
#>   splits                id         .metrics .notes          
#>   <list>                <chr>      <list>   <list>          
#> 1 <split [53940/19788]> Bootstrap1 <NULL>   <tibble [1 × 3]>
#> 2 <split [53940/19761]> Bootstrap2 <NULL>   <tibble [1 × 3]>
#> 3 <split [53940/19941]> Bootstrap3 <NULL>   <tibble [1 × 3]>
#> 
#> There were issues with some computations:
#> 
#>   - Error(s) x3: Error in fn(...): unused arguments (metrics_info = list(c("rmse",...
#> 
#> Run `show_notes(.Last.tune.result)` for more information.

Created on 2024-04-02 with reprex v2.1.0

@simonpcouch
Copy link
Contributor

Thanks for the issue!

The fixes for this issue should be upstream in agua after tidymodels/agua#52 need to get a CRAN release of that package out. Related to tidymodels/agua#53; will close this issue in favor of discussion there.

@simonpcouch
Copy link
Contributor

Your solution, for now, would be to install the development version of the package with pak::pak("tidymodels/agua"), restart R, and try again. :)

@walkerjameschris
Copy link
Author

Thank you for your quick response! Installing the development version did work.

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 Apr 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants