# chunking for Registry
tmp = makeRegistry(file.dir = NA, make.default = FALSE)
batchMap(identity, 1:25, reg = tmp)
ids = chunkIds(chunk.size = 10, reg = tmp)
print(ids)
print(table(ids$chunk))
# Creating chunks for an ExperimentRegistry
tmp = makeExperimentRegistry(file.dir = NA, make.default = FALSE)
prob = addProblem(reg = tmp, "prob1", data = iris, fun = function(job, data) nrow(data))
prob = addProblem(reg = tmp, "prob2", data = Titanic, fun = function(job, data) nrow(data))
algo = addAlgorithm(reg = tmp, "algo", fun = function(job, data, instance, i, ...) problem)
prob.designs = list(prob1 = data.table(), prob2 = data.table(x = 1:2))
algo.designs = list(algo = data.table(i = 1:3))
addExperiments(prob.designs, algo.designs, repls = 3, reg = tmp)
# group into chunks of 5 jobs, but do not put multiple problems into a single chunk
# -> only one problem has to be loaded per chunk, and only once because it is then cached.
ids = getJobTable(reg = tmp)[, .(job.id, problem, algorithm)]
chunked = chunkIds(ids, chunk.size = 5, group.by = "problem", reg = tmp)
print(chunked)
dcast(ijoin(ids, chunked), chunk ~ problem)
Run the code above in your browser using DataLab