The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
The futurize package allows you to easily turn sequential code
into parallel code by piping the sequential code to the futurize()
function. Easy!
library(futurize)
plan(multisession)
library(DiceKriging)
design <- expand.grid(x1 = seq(0, 1, length = 15), x2 = seq(0, 1, length = 15))
y <- apply(design, 1, function(x) x[1]^2 + x[2]^2)
m <- km(~., design = design, response = data.frame(y = y),
multistart = 20) |> futurize()
This vignette demonstrates how to use futurize to parallelize
DiceKriging functions, specifically km().
When fitting a kriging model via km(), the parameters of the
covariance function are estimated by maximum likelihood or
cross-validation. The optimization can be started from multiple
points (to avoid local optima), which can be done in parallel.
Fitting a kriging model with a single starting point:
library(DiceKriging)
design <- expand.grid(x1 = seq(0, 1, length = 15), x2 = seq(0, 1, length = 15))
y <- apply(design, MARGIN = 1, FUN = function(x) x[1]^2 + x[2]^2)
m <- km(~., design = design, response = data.frame(y = y))
To run multiple optimizer starts in parallel, set multistart > 1
and pipe to futurize():
library(futurize)
library(DiceKriging)
design <- expand.grid(x1 = seq(0, 1, length = 15), x2 = seq(0, 1, length = 15))
y <- apply(design, MARGIN = 1, FUN = function(x) x[1]^2 + x[2]^2)
m <- km(~., design = design, response = data.frame(y = y),
multistart = 20) |> futurize()
This distributes the multi-start runs across the available parallel workers, given that we have set up a parallel plan, e.g.
plan(multisession)
The built-in multisession backend parallelizes on your local
computer and works on all operating systems. There are other
parallel backends to choose from, including alternatives to
parallelize locally as well as distributed across remote machines,
e.g.
plan(future.mirai::mirai_multisession)
and
plan(future.batchtools::batchtools_slurm)
The following DiceKriging function is supported by futurize():
km()These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.