Skip to content

Commit

Permalink
dontrun + fixed test
Browse files Browse the repository at this point in the history
  • Loading branch information
mllg committed Feb 6, 2014
1 parent f3c7b77 commit d56fc33
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 21 deletions.
4 changes: 0 additions & 4 deletions R/addExperiments.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#' Default is FALSE.
#' @return Invisibly returns vector of ids of added experiments.
#' @examples
#' \dontrun{
#' ### EXAMPLE 1 ###
#' reg <- makeExperimentRegistry(id="example1", file.dir=tempfile())
#'
Expand Down Expand Up @@ -93,7 +92,6 @@
#'
#' # Submit the jobs to the batch system
#' submitJobs(reg)
#' waitForJobs(reg)
#'
#' # Calculate the misclassification rate for all (already done) jobs.
#' reduce <- function(job, res) {
Expand Down Expand Up @@ -139,11 +137,9 @@
#' # add experiments and submit
#' addExperiments(reg, repls=10)
#' submitJobs(reg)
#' waitForJobs(reg)
#'
#' # Gather informations from the experiments, in this case function value and if the algorithm convergenced:
#' reduceResultsExperiments(reg, fun=function(job, res) res[c("value", "convergence")])
#' }
#' @aliases Experiment
#' @export
addExperiments = function(reg, prob.designs, algo.designs, repls=1L, skip.defined=FALSE) {
Expand Down
3 changes: 0 additions & 3 deletions R/getIndex.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#' @return [\code{list}]. List of factors.
#' @export
#' @examples
#' \dontrun{
#' # create a registry and add problems and algorithms
#' reg = makeExperimentRegistry("getIndex", file.dir=tempfile(""))
#' addProblem(reg, "prob", static = 1)
Expand All @@ -37,7 +36,6 @@
#' ad = list(makeDesign("f0"), makeDesign("f1", exhaustive=list(i=1:10, k=1:3)))
#' addExperiments(reg, algo.designs=ad)
#' submitJobs(reg)
#' waitForJobs(reg)
#'
#' # get grouped job ids
#' ids = getJobIds(reg)
Expand All @@ -50,7 +48,6 @@
#' f = function(aggr, job, res) aggr + res
#' by(ids.f1, getIndex(reg, ids.f1, by.algo.pars=k), reduceResults, reg=reg, fun=f)
#' by(ids.f1, getIndex(reg, ids.f1, by.algo.pars=i), reduceResults, reg=reg, fun=f)
#' }
getIndex = function(reg, ids, by.prob=FALSE, by.algo=FALSE, by.repl=FALSE,
by.prob.pars, by.algo.pars, enclos = parent.frame()) {
checkArg(reg, "ExperimentRegistry")
Expand Down
3 changes: 0 additions & 3 deletions R/reduceResultsExperiments.R
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ reduceResultsExperiments = function(reg, ids, part=NA_character_, fun, ...,
#' @return [\code{character}]. Names of of columns.
#' @export
#' @examples
#' \dontrun{
#' reg <- makeExperimentRegistry("BatchExample", seed=123, file.dir=tempfile())
#' addProblem(reg, "p1", static=1)
#' addProblem(reg, "p2", static=2)
Expand All @@ -139,11 +138,9 @@ reduceResultsExperiments = function(reg, ids, part=NA_character_, fun, ...,
#' ad2 <- makeDesign("a2", exhaustive=list(alpha=1:2, beta=5:6))
#' addExperiments(reg, algo.designs=list(ad1, ad2), repls=2)
#' submitJobs(reg)
#' waitForJobs(reg)
#' data <- reduceResultsExperiments(reg)
#' library(plyr)
#' ddply(data, getResultVars(data, "group"), summarise, mean_y = mean(y))
#' }
getResultVars = function(data, type="group") {
checkArg(data, "ReducedResultsExperiments")
checkArg(type, choices=c("prob", "prob.pars", "algo", "algo.pars", "group", "result"))
Expand Down
2 changes: 1 addition & 1 deletion inst/tests/test_testJob.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ test_that("testJob", {
a1 = addAlgorithm(reg, id="a1", fun=function(static, dynamic) static)
addExperiments(reg, p1, a1)
expect_equal(testJob(reg, 1L, external=FALSE), 1)
if (isExpensiveExampleOk())
if (isExpensiveExampleOk() && interactive()) # FIXME
expect_equal(testJob(reg, 1L, external=TRUE), 1)
})
4 changes: 0 additions & 4 deletions man/addExperiments.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ Add experiments for running algorithms on problems to the
registry, so they can be executed later.
}
\examples{
\dontrun{
### EXAMPLE 1 ###
reg <- makeExperimentRegistry(id="example1", file.dir=tempfile())

Expand Down Expand Up @@ -111,7 +110,6 @@ if (do.tests) {

# Submit the jobs to the batch system
submitJobs(reg)
waitForJobs(reg)

# Calculate the misclassification rate for all (already done) jobs.
reduce <- function(job, res) {
Expand Down Expand Up @@ -157,10 +155,8 @@ addAlgorithm(reg, "sann", fun=function(static, dynamic) {
# add experiments and submit
addExperiments(reg, repls=10)
submitJobs(reg)
waitForJobs(reg)

# Gather informations from the experiments, in this case function value and if the algorithm convergenced:
reduceResultsExperiments(reg, fun=function(job, res) res[c("value", "convergence")])
}
}

3 changes: 0 additions & 3 deletions man/getIndex.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ like \code{\link{tapply}}, \code{\link{by}} or
\code{\link{aggregate}}.
}
\examples{
\dontrun{
# create a registry and add problems and algorithms
reg = makeExperimentRegistry("getIndex", file.dir=tempfile(""))
addProblem(reg, "prob", static = 1)
Expand All @@ -54,7 +53,6 @@ addAlgorithm(reg, "f1", function(static, dynamic, i, k) static * i^k)
ad = list(makeDesign("f0"), makeDesign("f1", exhaustive=list(i=1:10, k=1:3)))
addExperiments(reg, algo.designs=ad)
submitJobs(reg)
waitForJobs(reg)

# get grouped job ids
ids = getJobIds(reg)
Expand All @@ -68,5 +66,4 @@ f = function(aggr, job, res) aggr + res
by(ids.f1, getIndex(reg, ids.f1, by.algo.pars=k), reduceResults, reg=reg, fun=f)
by(ids.f1, getIndex(reg, ids.f1, by.algo.pars=i), reduceResults, reg=reg, fun=f)
}
}

3 changes: 0 additions & 3 deletions man/getResultVars.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ getResultVars(data, type = "group")
Useful helper for e.g. package plyr and such.
}
\examples{
\dontrun{
reg <- makeExperimentRegistry("BatchExample", seed=123, file.dir=tempfile())
addProblem(reg, "p1", static=1)
addProblem(reg, "p2", static=2)
Expand All @@ -35,10 +34,8 @@ ad1 <- makeDesign("a1", exhaustive=list(alpha=1:2))
ad2 <- makeDesign("a2", exhaustive=list(alpha=1:2, beta=5:6))
addExperiments(reg, algo.designs=list(ad1, ad2), repls=2)
submitJobs(reg)
waitForJobs(reg)
data <- reduceResultsExperiments(reg)
library(plyr)
ddply(data, getResultVars(data, "group"), summarise, mean_y = mean(y))
}
}

0 comments on commit d56fc33

Please sign in to comment.