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

add tanh to allowed act_funs #1240

Merged
merged 1 commit into from
Jan 29, 2025
Merged

add tanh to allowed act_funs #1240

merged 1 commit into from
Jan 29, 2025

Conversation

EmilHvitfeldt
Copy link
Member

to close #1228

it seems fairly clear to me that the line was copied from 525baee#diff-cc3c0fc4a8fe94138bbf865fcad37457b96799008c3910abe158f2e187f7134bL149, but tanh is a valid input as well.

library(tidymodels)

model <- 
  mlp(activation = tune()) %>%
  set_engine("keras") %>%
  set_mode("classification")

set.seed(1)
res <- tune_grid(
  workflow(class ~ ., model),
  vfold_cv(sim_classification(1000)),
  grid = 3
)

res |>
  collect_metrics()
#> # A tibble: 9 × 7
#>   activation .metric     .estimator  mean     n std_err .config             
#>   <chr>      <chr>       <chr>      <dbl> <int>   <dbl> <chr>               
#> 1 relu       accuracy    binary     0.722    10 0.0137  Preprocessor1_Model1
#> 2 relu       brier_class binary     0.184    10 0.00557 Preprocessor1_Model1
#> 3 relu       roc_auc     binary     0.803    10 0.00916 Preprocessor1_Model1
#> 4 tanh       accuracy    binary     0.745    10 0.0139  Preprocessor1_Model2
#> 5 tanh       brier_class binary     0.169    10 0.00733 Preprocessor1_Model2
#> 6 tanh       roc_auc     binary     0.832    10 0.0177  Preprocessor1_Model2
#> 7 softmax    accuracy    binary     0.736    10 0.0142  Preprocessor1_Model3
#> 8 softmax    brier_class binary     0.194    10 0.00731 Preprocessor1_Model3
#> 9 softmax    roc_auc     binary     0.793    10 0.0309  Preprocessor1_Model3

@EmilHvitfeldt EmilHvitfeldt requested a review from topepo January 28, 2025 22:56
@topepo topepo merged commit 6e0983f into main Jan 29, 2025
10 checks passed
@topepo topepo deleted the fix1228 branch January 29, 2025 13:07
@topepo
Copy link
Member

topepo commented Jan 29, 2025

Thanks!

Copy link

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.

@github-actions github-actions bot locked and limited conversation to collaborators Feb 13, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

default parameter values for mlp(activation) cause errors with engine = "keras"
2 participants