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(SuperLearner)
res <- CV.SuperLearner(Y = Y, X = X, SL.library = SL.library) |> futurize()
This vignette demonstrates how to use this approach to parallelize
SuperLearner functions such as CV.SuperLearner().
The SuperLearner package provides a framework for ensemble machine learning in R. The algorithm utilizes V-fold cross-validation to combine multiple prediction algorithms into a single ensemble predictor. Since cross-validation involves training many models independently, it is a perfect candidate for parallelization.
The CV.SuperLearner() function evaluates the cross-validated risk of
the Super Learner ensemble. For example:
library(SuperLearner)
n <- 100
p <- 5
X <- as.data.frame(matrix(rnorm(n * p), n, p))
Y <- X[, 1] + X[, 2] + rnorm(n)
SL.library <- c("SL.glm", "SL.mean")
res <- CV.SuperLearner(Y = Y, X = X, V = 10, SL.library = SL.library)
Here CV.SuperLearner() evaluates sequentially. To run in parallel,
pipe to futurize():
library(futurize)
library(SuperLearner)
res <- CV.SuperLearner(Y = Y, X = X, V = 10, SL.library = SL.library) |> futurize()
This will distribute the cross-validation fold evaluations across the available parallel workers, given that we have set up parallel workers, 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 SuperLearner functions are supported by futurize():
CV.SuperLearner() with seed = TRUE as the defaultThese 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.