| grid_depth | R Documentation |
grid_depth() extends standard grid generation to support multi-layer
neural network architectures. It creates heterogeneous layer configurations
by generating list columns for hidden_neurons and activations.
grid_depth(
x,
...,
n_hlayer = 2L,
size = 5L,
type = c("regular", "random", "latin_hypercube", "max_entropy", "audze_eglais"),
original = TRUE,
levels = 3L,
variogram_range = 0.5,
iter = 1000L
)
## S3 method for class 'parameters'
grid_depth(
x,
...,
n_hlayer = 2L,
size = 5L,
type = c("regular", "random", "latin_hypercube", "max_entropy", "audze_eglais"),
original = TRUE,
levels = 3L,
variogram_range = 0.5,
iter = 1000L
)
## S3 method for class 'list'
grid_depth(
x,
...,
n_hlayer = 2L,
size = 5L,
type = c("regular", "random", "latin_hypercube", "max_entropy", "audze_eglais"),
original = TRUE,
levels = 3L,
variogram_range = 0.5,
iter = 1000L
)
## S3 method for class 'workflow'
grid_depth(
x,
...,
n_hlayer = 2L,
size = 5L,
type = c("regular", "random", "latin_hypercube", "max_entropy", "audze_eglais"),
original = TRUE,
levels = 3L,
variogram_range = 0.5,
iter = 1000L
)
## S3 method for class 'model_spec'
grid_depth(
x,
...,
n_hlayer = 2L,
size = 5L,
type = c("regular", "random", "latin_hypercube", "max_entropy", "audze_eglais"),
original = TRUE,
levels = 3L,
variogram_range = 0.5,
iter = 1000L
)
## S3 method for class 'param'
grid_depth(
x,
...,
n_hlayer = 2L,
size = 5L,
type = c("regular", "random", "latin_hypercube", "max_entropy", "audze_eglais"),
original = TRUE,
levels = 3L,
variogram_range = 0.5,
iter = 1000L
)
## Default S3 method:
grid_depth(
x,
...,
n_hlayer = 2L,
size = 5L,
type = c("regular", "random", "latin_hypercube", "max_entropy", "audze_eglais"),
original = TRUE,
levels = 3L,
variogram_range = 0.5,
iter = 1000L
)
x |
A |
... |
One or more |
n_hlayer |
Integer vector specifying number of hidden layers to generate
(e.g., |
size |
Integer. Number of parameter combinations to generate. |
type |
Character. Type of grid: "regular", "random", "latin_hypercube", "max_entropy", or "audze_eglais". |
original |
Logical. Should original parameter ranges be used? |
levels |
Integer. Levels per parameter for regular grids. |
variogram_range |
Numeric. Range for audze_eglais design. |
iter |
Integer. Iterations for max_entropy optimization. |
This function is specifically for {kindling} models. The n_hlayer parameter
determines network depth and creates list columns for hidden_neurons and
activations, where each element is a vector of length matching the sampled depth.
When n_hlayer is a parameter object (created with n_hlayers()), it will be
treated as a tunable parameter and sampled according to its defined range.
A tibble with list columns for hidden_neurons and activations,
where each element is a vector of length n_hlayer.
## Not run:
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)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.