| grid_search_check | R Documentation |
This function provides a quick runtime estimate for grid_search under the same settings.
It performs two short pilot runs on smaller grids (with zoom = 0) and extrapolates the expected
time for the full grid and the requested number of zoom-in layers.
grid_search_check(
FUN,
grid,
MoreArgs = NULL,
zoom = 0,
decay = 0.5,
num = 1,
parallel = FALSE,
cores = NULL,
silent = TRUE
)
FUN |
the target function to be minimized. |
grid |
an object of class |
MoreArgs |
a named list of additional arguments to |
zoom |
number of (additional) zoom-in layers, |
decay |
a number in |
num |
number of points to return at each grid search, |
parallel |
a logical; if |
cores |
an integer specifying the requested number of workers when |
silent |
a logical indicating whether progress information is printed. |
This is useful before launching a large run, for example on a compute server or under a batch system such as SLURM, where an approximate runtime is needed to request resources.
The boolean silent controls whether progress information is printed to the console.
For details on the algorithm and the meaning of the arguments, see grid_search.
a numeric value giving the estimated runtime in seconds.
Yukai Yang, yukai.yang@statistik.uu.se
build_grid, grid_search
# Rastrigin function
ndim <- 2
nA <- 10
Rastrigin <- function(vx) nA * ndim + sum(vx * vx - nA * cos(2 * pi * vx))
# Build a grid
bin <- c(from = -5.12, to = 5.12, by = .5)
grid <- build_grid(bin, bin)
# Estimate runtime (serial)
t_est <- grid_search_check(Rastrigin, grid, silent = FALSE)
t_est
# Finer grid
bin <- c(from = -5.12, to = 5.12, by = .1)
grid <- build_grid(bin, bin)
# Estimate runtime, then run the search
t_est <- grid_search_check(Rastrigin, grid, parallel = TRUE, cores = 2, silent = FALSE)
ret <- grid_search(Rastrigin, grid, parallel = TRUE, cores = 2, silent = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.