Skip to content

Commit 9d76f4d

Browse files
committed
improve activation check error
1 parent d94ccde commit 9d76f4d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

R/mlp-fit.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,10 @@ brulee_mlp_bridge <- function(processed, epochs, hidden_units, activation,
452452
allowed_activation <- brulee_activations()
453453
good_activation <- activation %in% allowed_activation
454454
if (!all(good_activation)) {
455-
cli::cli_abort(paste("'activation' should be one of: ", paste0(allowed_activation, collapse = ", ")))
455+
cli::cli_abort(
456+
"{.arg activation} should be one of: {allowed_activation}, not
457+
{.val {activation}}."
458+
)
456459
}
457460

458461
if (optimizer == "LBFGS" & !is.null(batch_size)) {

tests/testthat/_snaps/mlp-regression.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
brulee_mlp(reg_x_mat, reg_y, epochs = 2, activation = NA)
4545
Condition
4646
Error in `brulee_mlp_bridge()`:
47-
! '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
47+
! `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.
4848

4949
---
5050

0 commit comments

Comments
 (0)