| tune_densemlp | R Documentation |
Fits densemlp() for every combination in grid (each repeated repeats
times with successive seeds), ranks candidates by their best internal
validation loss, and optionally refits the best configuration on the
full data.
tune_densemlp(
x,
y,
task = c("auto", "regression", "binary", "multiclass", "survival", "count"),
grid = NULL,
validation = 0.2,
seed = 1L,
repeats = 3L,
ncores = 1L,
verbose = FALSE,
refit = TRUE,
weights = NULL
)
x |
Predictor data.frame or matrix. |
y |
Outcome vector. |
task |
|
grid |
A named list of candidate values. Supported names:
|
validation |
Validation fraction used for every candidate fit. |
seed |
Base random seed. |
repeats |
Number of repeated seeds per candidate. |
ncores |
Number of cores used to fit candidates in parallel (see
|
verbose |
Print per-candidate progress. |
refit |
Refit the best configuration on the supplied data. |
weights |
Optional non-negative case weights, one per row, passed to
every |
A list of class densemlp_tuned with results (one row per
candidate, ranked best first by mean validation loss), best_config,
and, when refit = TRUE, best_fit.
set.seed(1)
x <- data.frame(a = rnorm(80), b = rnorm(80))
y <- x$a - 0.5 * x$b + rnorm(80, sd = 0.1)
tuned <- tune_densemlp(
x, y, repeats = 1,
grid = list(hidden_units = list(c(8), c(16, 8)), epochs = c(20))
)
tuned$best_config
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.