Skip to content

Commit

Permalink
improve activation check error (#88)
Browse files Browse the repository at this point in the history
Co-authored-by: topepo <mxkuhn@gmail.com>
  • Loading branch information
EmilHvitfeldt and topepo authored Jan 30, 2025
1 parent da1aee4 commit 3b63e49
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion R/mlp-fit.R
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,10 @@ brulee_mlp_bridge <- function(processed, epochs, hidden_units, activation,
allowed_activation <- brulee_activations()
good_activation <- activation %in% allowed_activation
if (!all(good_activation)) {
cli::cli_abort(paste("'activation' should be one of: ", paste0(allowed_activation, collapse = ", ")))
cli::cli_abort(
"{.arg activation} should be one of: {allowed_activation}, not
{.val {activation}}."
)
}

if (optimizer == "LBFGS" & !is.null(batch_size)) {
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/mlp-regression.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
brulee_mlp(reg_x_mat, reg_y, epochs = 2, activation = NA)
Condition
Error in `brulee_mlp_bridge()`:
! 'activation' should be one of: celu, elu, gelu, hardshrink, hardsigmoid, hardtanh, leaky_relu, linear, log_sigmoid, relu, relu6, rrelu, selu, sigmoid, silu, softplus, softshrink, softsign, tanh, tanhshrink
! `activation` should be one of: celu, elu, gelu, hardshrink, hardsigmoid, hardtanh, leaky_relu, linear, log_sigmoid, relu, relu6, rrelu, selu, sigmoid, silu, softplus, softshrink, softsign, tanh, and tanhshrink, not NA.

---

Expand Down

0 comments on commit 3b63e49

Please sign in to comment.