# \donttest{
if (FALSE) {
library(dials)
library(workflows)
library(tune)
# Method 1: Fixed depth
grid = grid_depth(
hidden_neurons(c(32L, 128L)),
activations(c("relu", "elu")),
epochs(c(50L, 200L)),
n_hlayer = 2:3,
type = "random",
size = 20
)
# Method 2: Tunable depth using parameter object
grid = grid_depth(
hidden_neurons(c(32L, 128L)),
activations(c("relu", "elu")),
epochs(c(50L, 200L)),
n_hlayer = n_hlayers(range = c(2L, 4L)),
type = "random",
size = 20
)
# Method 3: From workflow
wf = workflow() |>
add_model(mlp_kindling(hidden_neurons = tune(), activations = tune())) |>
add_formula(y ~ .)
grid = grid_depth(wf, n_hlayer = 2:4, type = "latin_hypercube", size = 15)
}
# }
Run the code above in your browser using DataLab