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

default parameter values for mlp(activation) cause errors with engine = "keras" #1228

Open
simonpcouch opened this issue Jan 10, 2025 · 0 comments

Comments

@simonpcouch
Copy link
Contributor

Not sure if this issue would be more cozy in dials (where the parameter function dials::activation() is defined) or here (where the parameter function is referenced), but allowing tune to sample values of activation when tuning mlp(engine = "keras") results in errors:

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
)
#> → A | error:   `activation` must be one of "linear", "softmax", "relu", or "elu", not
#>                "tanh".
#> There were issues with some computations   A: x10
#> 

Created on 2025-01-10 with reprex v2.1.1

That error is from parsnip itself:

 54. ├─parsnip::keras_mlp(activation = "tanh")
 55. │ └─rlang::arg_match(activation, act_funs, )

parsnip/R/mlp.R

Lines 195 to 196 in 27df158

act_funs <- c("linear", "softmax", "relu", "elu")
rlang::arg_match(activation, act_funs,)

Possibly a followup on #1019.

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