Skip to content

Commit 1597a76

Browse files
Merge pull request #1245 from tidymodels/fix-keras-wrong-activation
2 parents 5ec72c9 + 47cacf7 commit 1597a76

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

R/mlp.R

+2-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,8 @@ keras_mlp <-
196196
good_activation <- activation %in% allowed_keras_activation
197197
if (!all(good_activation)) {
198198
cli::cli_abort(
199-
"{.arg activation} should be one of: {allowed_activation}."
199+
"{.arg activation} should be one of: {allowed_keras_activation}, not
200+
{.val {activation}}."
200201
)
201202
}
202203

tests/testthat/test-mlp_keras.R

+7
Original file line numberDiff line numberDiff line change
@@ -275,4 +275,11 @@ test_that('all keras activation functions', {
275275
keras::backend()$clear_session()
276276
}
277277

278+
expect_snapshot(
279+
error = TRUE,
280+
mlp(mode = "classification", hidden_units = 2, penalty = 0.01, epochs = 2,
281+
activation = "invalid") %>%
282+
set_engine("keras", verbose = 0) %>%
283+
parsnip::fit(Class ~ A + B, data = modeldata::two_class_dat)
284+
)
278285
})

0 commit comments

Comments
 (0)