View source: R/ExperimentRegistry.R
makeExperimentRegistry | R Documentation |
makeExperimentRegistry
constructs a special Registry
which
is suitable for the definition of large scale computer experiments.
Each experiments consists of a Problem
and an Algorithm
.
These can be parametrized with addExperiments
to actually define computational
jobs.
makeExperimentRegistry(
file.dir = "registry",
work.dir = getwd(),
conf.file = findConfFile(),
packages = character(0L),
namespaces = character(0L),
source = character(0L),
load = character(0L),
seed = NULL,
make.default = TRUE
)
file.dir |
[ If you pass |
work.dir |
[ The provided path will get normalized unless it is given relative to the home directory (i.e., starting with “~”). Note that some templates do not handle relative paths well. |
conf.file |
[ The file lookup is implemented in the internal (but exported) function
Set to |
packages |
[ |
namespaces |
[ |
source |
[ |
load |
[ |
seed |
[ |
make.default |
[ |
[ExperimentRegistry
].
tmp = makeExperimentRegistry(file.dir = NA, make.default = FALSE)
# Definde one problem, two algorithms and add them with some parameters:
addProblem(reg = tmp, "p1",
fun = function(job, data, n, mean, sd, ...) rnorm(n, mean = mean, sd = sd))
addAlgorithm(reg = tmp, "a1", fun = function(job, data, instance, ...) mean(instance))
addAlgorithm(reg = tmp, "a2", fun = function(job, data, instance, ...) median(instance))
ids = addExperiments(reg = tmp, list(p1 = data.table::CJ(n = c(50, 100), mean = -2:2, sd = 1:4)))
# Overview over defined experiments:
tmp$problems
tmp$algorithms
summarizeExperiments(reg = tmp)
summarizeExperiments(reg = tmp, by = c("problem", "algorithm", "n"))
ids = findExperiments(prob.pars = (n == 50), reg = tmp)
print(unwrap(getJobPars(ids, reg = tmp)))
# Submit jobs
submitJobs(reg = tmp)
waitForJobs(reg = tmp)
# Reduce the results of algorithm a1
ids.mean = findExperiments(algo.name = "a1", reg = tmp)
reduceResults(ids.mean, fun = function(aggr, res, ...) c(aggr, res), reg = tmp)
# Join info table with all results and calculate mean of results
# grouped by n and algorithm
ids = findDone(reg = tmp)
pars = unwrap(getJobPars(ids, reg = tmp))
results = unwrap(reduceResultsDataTable(ids, fun = function(res) list(res = res), reg = tmp))
tab = ljoin(pars, results)
tab[, list(mres = mean(res)), by = c("n", "algorithm")]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.