Last updated on 2019-12-21 10:47:51 CET.
Flavor | Version | Tinstall | Tcheck | Ttotal | Status | Flags |
---|---|---|---|---|---|---|
r-devel-linux-x86_64-debian-clang | 0.5.0 | 8.14 | 79.15 | 87.29 | ERROR | |
r-devel-linux-x86_64-debian-gcc | 0.5.0 | 7.06 | 126.70 | 133.76 | ERROR | |
r-devel-linux-x86_64-fedora-clang | 0.5.0 | 222.51 | OK | |||
r-devel-linux-x86_64-fedora-gcc | 0.5.0 | 224.66 | OK | |||
r-devel-windows-ix86+x86_64 | 0.5.0 | 20.00 | 175.00 | 195.00 | OK | |
r-devel-windows-ix86+x86_64-gcc8 | 0.5.0 | 19.00 | 235.00 | 254.00 | OK | |
r-patched-linux-x86_64 | 0.5.0 | OK | ||||
r-patched-solaris-x86 | 0.5.0 | 318.10 | OK | |||
r-release-linux-x86_64 | 0.5.0 | 7.99 | 146.09 | 154.08 | OK | |
r-release-windows-ix86+x86_64 | 0.5.0 | 13.00 | 206.00 | 219.00 | OK | |
r-release-osx-x86_64 | 0.5.0 | OK | ||||
r-oldrel-windows-ix86+x86_64 | 0.5.0 | 7.00 | 166.00 | 173.00 | OK | |
r-oldrel-osx-x86_64 | 0.5.0 | OK |
Version: 0.5.0
Check: examples
Result: ERROR
Running examples in 'mvtboost-Ex.R' failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: mvtb
> ### Title: Fitting a Multivariate Tree Boosting Model
> ### Aliases: mvtb mvtb.fit
>
> ### ** Examples
>
> data(wellbeing)
> Y <- wellbeing[,21:26]
> X <- wellbeing[,1:20]
> Ys <- scale(Y)
> cont.id <- unlist(lapply(X,is.numeric))
> Xs <- scale(X[,cont.id])
>
> ## Fit the model
> res <- mvtb(Y=Ys,X=Xs)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
mvtboost
--- call from context ---
mvtb(Y = Ys, X = Xs)
--- call from argument ---
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
--- R stacktrace ---
where 1: mvtb(Y = Ys, X = Xs)
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (Y, X, n.trees = 100, shrinkage = 0.01, interaction.depth = 1,
distribution = "gaussian", train.fraction = 1, bag.fraction = 1,
cv.folds = 1, s = NULL, seednum = NULL, compress = FALSE,
save.cv = FALSE, iter.details = TRUE, verbose = FALSE, mc.cores = 1,
...)
{
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
if (is.null(ncol(X))) {
X <- as.matrix(X)
}
params <- c(as.list(environment()), list(...))
if (!is.null(seednum)) {
set.seed(seednum)
}
stopifnot(nrow(X) == nrow(Y))
n <- nrow(X)
k <- ncol(Y)
p <- ncol(X)
if (is.null(colnames(X))) {
colnames(X) <- paste("X", 1:p, sep = "")
}
if (is.null(colnames(Y))) {
colnames(Y) <- paste("Y", 1:k, sep = "")
}
xnames <- colnames(X)
ynames <- colnames(Y)
if (is.null(s)) {
s <- sample(1:n, floor(n * train.fraction), replace = F)
}
if (any(is.na(Y))) {
stop("NAs not allowed in outcome variables.")
}
if (shrinkage > 1 | shrinkage <= 0) {
stop("shrinkage should be > 0, < 1")
}
if (train.fraction > 1 | train.fraction <= 0) {
stop("train.fraction should be > 0, < 1")
}
if (bag.fraction > 1 | bag.fraction <= 0) {
stop("bag.fraction should be > 0, < 1")
}
trainerr <- testerr <- vector(length = n.trees)
if (cv.folds > 1) {
ocv <- mvtbCV(Y = Y, X = X, cv.folds = cv.folds, s = s,
save.cv = save.cv, mc.cores = mc.cores, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, seednum = seednum)
best.iters.cv <- ocv$best.iters.cv
cv.err <- ocv$cv.err
out.fit <- ocv$models.k[[cv.folds + 1]]
}
else {
out.fit <- mvtb.fit(Y = Y, X = X, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, s = s, seednum = seednum, ...)
best.iters.cv <- NULL
cv.err <- NULL
ocv <- NULL
}
models <- out.fit$models
trainerr <- out.fit$trainerr
testerr <- out.fit$testerr
best.trees <- list(best.testerr = which.min(testerr), best.cv = best.iters.cv,
last = n.trees)
if (!save.cv) {
ocv <- NULL
}
if (iter.details == T) {
fl <- list(models = models, best.trees = best.trees,
params = params, trainerr = trainerr, testerr = testerr,
cv.err = cv.err, ocv = ocv, s = s, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
else {
fl <- list(models = models, best.trees = best.trees,
params = params, s = s, ocv = ocv, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
if (compress) {
fl <- lapply(fl, comp)
}
class(fl) <- "mvtb"
return(fl)
}
<bytecode: 0xbd5c358>
<environment: namespace:mvtboost>
--- function search by body ---
Function mvtb in namespace mvtboost has this body.
----------- END OF FAILURE REPORT --------------
Error in if (class(Y) != "matrix") { : the condition has length > 1
Calls: mvtb
Execution halted
Flavor: r-devel-linux-x86_64-debian-clang
Version: 0.5.0
Check: tests
Result: ERROR
Running 'testthat.R' [7s/9s]
Running the tests in 'tests/testthat.R' failed.
Complete output:
> library(testthat)
> library(mvtboost)
>
> test_check("mvtboost")
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
mvtboost
--- call from context ---
mvtb(Y = Y, X = X)
--- call from argument ---
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
--- R stacktrace ---
where 1 at testthat/test_covex.R#19: mvtb(Y = Y, X = X)
where 2: eval(code, test_env)
where 3: eval(code, test_env)
where 4: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 5: doTryCatch(return(expr), name, parentenv, handler)
where 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 7: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 8: doTryCatch(return(expr), name, parentenv, handler)
where 9: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 10: tryCatchList(expr, classes, parentenv, handlers)
where 11: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 12: test_code(NULL, exprs, env)
where 13: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 14: force(code)
where 15: doWithOneRestart(return(expr), restart)
where 16: withOneRestart(expr, restarts[[1L]])
where 17: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 18: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
{
reporter$start_file(basename(path))
lister$start_file(basename(path))
source_file(path, new.env(parent = env), chdir = TRUE,
wrap = wrap)
reporter$.end_context()
reporter$end_file()
})
where 19: FUN(X[[i]], ...)
where 20: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 21: force(code)
where 22: doWithOneRestart(return(expr), restart)
where 23: withOneRestart(expr, restarts[[1L]])
where 24: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 25: with_reporter(reporter = current_reporter, results <- lapply(paths,
test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
load_helpers = FALSE, wrap = wrap))
where 26: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 27: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
wrap = wrap)
where 28: test_package_dir(package = package, test_path = test_path, filter = filter,
reporter = reporter, ..., stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 29: test_check("mvtboost")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (Y, X, n.trees = 100, shrinkage = 0.01, interaction.depth = 1,
distribution = "gaussian", train.fraction = 1, bag.fraction = 1,
cv.folds = 1, s = NULL, seednum = NULL, compress = FALSE,
save.cv = FALSE, iter.details = TRUE, verbose = FALSE, mc.cores = 1,
...)
{
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
if (is.null(ncol(X))) {
X <- as.matrix(X)
}
params <- c(as.list(environment()), list(...))
if (!is.null(seednum)) {
set.seed(seednum)
}
stopifnot(nrow(X) == nrow(Y))
n <- nrow(X)
k <- ncol(Y)
p <- ncol(X)
if (is.null(colnames(X))) {
colnames(X) <- paste("X", 1:p, sep = "")
}
if (is.null(colnames(Y))) {
colnames(Y) <- paste("Y", 1:k, sep = "")
}
xnames <- colnames(X)
ynames <- colnames(Y)
if (is.null(s)) {
s <- sample(1:n, floor(n * train.fraction), replace = F)
}
if (any(is.na(Y))) {
stop("NAs not allowed in outcome variables.")
}
if (shrinkage > 1 | shrinkage <= 0) {
stop("shrinkage should be > 0, < 1")
}
if (train.fraction > 1 | train.fraction <= 0) {
stop("train.fraction should be > 0, < 1")
}
if (bag.fraction > 1 | bag.fraction <= 0) {
stop("bag.fraction should be > 0, < 1")
}
trainerr <- testerr <- vector(length = n.trees)
if (cv.folds > 1) {
ocv <- mvtbCV(Y = Y, X = X, cv.folds = cv.folds, s = s,
save.cv = save.cv, mc.cores = mc.cores, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, seednum = seednum)
best.iters.cv <- ocv$best.iters.cv
cv.err <- ocv$cv.err
out.fit <- ocv$models.k[[cv.folds + 1]]
}
else {
out.fit <- mvtb.fit(Y = Y, X = X, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, s = s, seednum = seednum, ...)
best.iters.cv <- NULL
cv.err <- NULL
ocv <- NULL
}
models <- out.fit$models
trainerr <- out.fit$trainerr
testerr <- out.fit$testerr
best.trees <- list(best.testerr = which.min(testerr), best.cv = best.iters.cv,
last = n.trees)
if (!save.cv) {
ocv <- NULL
}
if (iter.details == T) {
fl <- list(models = models, best.trees = best.trees,
params = params, trainerr = trainerr, testerr = testerr,
cv.err = cv.err, ocv = ocv, s = s, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
else {
fl <- list(models = models, best.trees = best.trees,
params = params, s = s, ocv = ocv, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
if (compress) {
fl <- lapply(fl, comp)
}
class(fl) <- "mvtb"
return(fl)
}
<bytecode: 0x9646e08>
<environment: namespace:mvtboost>
--- function search by body ---
Function mvtb in namespace mvtboost has this body.
----------- END OF FAILURE REPORT --------------
-- 1. Error: (unknown) (@test_covex.R#19) -------------------------------------
the condition has length > 1
Backtrace:
1. mvtboost::mvtb(Y = Y, X = X)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
mvtboost
--- call from context ---
mvtb(X = X, Y = Y, s = 1:500, n.trees = n.trees, shrinkage = 0.5,
cv.folds = 3, save.cv = TRUE)
--- call from argument ---
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
--- R stacktrace ---
where 1 at testthat/test_cv.R#54: mvtb(X = X, Y = Y, s = 1:500, n.trees = n.trees, shrinkage = 0.5,
cv.folds = 3, save.cv = TRUE)
where 2: eval(code, test_env)
where 3: eval(code, test_env)
where 4: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 5: doTryCatch(return(expr), name, parentenv, handler)
where 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 7: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 8: doTryCatch(return(expr), name, parentenv, handler)
where 9: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 10: tryCatchList(expr, classes, parentenv, handlers)
where 11: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 12: test_code(desc, code, env = parent.frame())
where 13 at testthat/test_cv.R#52: test_that("mvtb - CV param", {
out <- mvtb(X = X, Y = Y, s = 1:500, n.trees = n.trees, shrinkage = 0.5,
cv.folds = 3, save.cv = TRUE)
out2 <- mvtb(X = X, Y = Y, n.trees = n.trees, train.fraction = 0.5,
shrinkage = 0.5, cv.folds = 3, s = NULL, save.cv = TRUE)
check.samp(out$ocv, s = out$params$s, folds = 3)
s <- out2$s
fold.obs <- lapply(out2$ocv$models.k[1:3], function(out) {
unique(out$s)
})
expect_true(all(unique(unlist(fold.obs)) %in% s))
expect_true(all(s %in% unique(unlist(fold.obs))))
expect_true(all(!unlist(lapply(out$ocv$models.k, function(m) {
any(m$s > 500)
}))))
out1 <- mvtb(X = X, Y = Y, s = 1:500, n.trees = n.trees,
shrinkage = 0.5, cv.folds = 3, seednum = 1)
out2 <- mvtb(X = X, Y = Y, s = 1:500, n.trees = n.trees,
shrinkage = 0.5, cv.folds = 3, seednum = 1)
expect_equal(out1, out2)
out1 <- mvtb(X = X, Y = Y, train.fraction = 0.5, n.trees = n.trees,
shrinkage = 0.5, cv.folds = 3, seednum = 1)
out2 <- mvtb(X = X, Y = Y, train.fraction = 0.5, n.trees = n.trees,
shrinkage = 0.5, cv.folds = 3, seednum = 1)
expect_equal(out1, out2)
out1 <- mvtb(X = X, Y = Y, train.fraction = 0.5, n.trees = n.trees,
shrinkage = 0.5, cv.folds = 3, seednum = 1)
out2 <- mvtb(X = X, Y = Y, train.fraction = 0.5, n.trees = n.trees,
shrinkage = 0.5, cv.folds = 3, seednum = 1)
expect_equal(out1, out2)
out1 <- mvtb(X = X, Y = Y, train.fraction = 0.5, n.trees = n.trees,
shrinkage = 0.5, cv.folds = 3, bag.frac = 0.5, seednum = 1)
out2 <- mvtb(X = X, Y = Y, train.fraction = 0.5, n.trees = n.trees,
shrinkage = 0.5, cv.folds = 3, bag.frac = 0.5, seednum = 1)
expect_equal(out1, out2)
})
where 14: eval(code, test_env)
where 15: eval(code, test_env)
where 16: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 17: doTryCatch(return(expr), name, parentenv, handler)
where 18: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 19: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 20: doTryCatch(return(expr), name, parentenv, handler)
where 21: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 22: tryCatchList(expr, classes, parentenv, handlers)
where 23: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 24: test_code(NULL, exprs, env)
where 25: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 26: force(code)
where 27: doWithOneRestart(return(expr), restart)
where 28: withOneRestart(expr, restarts[[1L]])
where 29: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 30: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
{
reporter$start_file(basename(path))
lister$start_file(basename(path))
source_file(path, new.env(parent = env), chdir = TRUE,
wrap = wrap)
reporter$.end_context()
reporter$end_file()
})
where 31: FUN(X[[i]], ...)
where 32: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 33: force(code)
where 34: doWithOneRestart(return(expr), restart)
where 35: withOneRestart(expr, restarts[[1L]])
where 36: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 37: with_reporter(reporter = current_reporter, results <- lapply(paths,
test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
load_helpers = FALSE, wrap = wrap))
where 38: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 39: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
wrap = wrap)
where 40: test_package_dir(package = package, test_path = test_path, filter = filter,
reporter = reporter, ..., stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 41: test_check("mvtboost")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (Y, X, n.trees = 100, shrinkage = 0.01, interaction.depth = 1,
distribution = "gaussian", train.fraction = 1, bag.fraction = 1,
cv.folds = 1, s = NULL, seednum = NULL, compress = FALSE,
save.cv = FALSE, iter.details = TRUE, verbose = FALSE, mc.cores = 1,
...)
{
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
if (is.null(ncol(X))) {
X <- as.matrix(X)
}
params <- c(as.list(environment()), list(...))
if (!is.null(seednum)) {
set.seed(seednum)
}
stopifnot(nrow(X) == nrow(Y))
n <- nrow(X)
k <- ncol(Y)
p <- ncol(X)
if (is.null(colnames(X))) {
colnames(X) <- paste("X", 1:p, sep = "")
}
if (is.null(colnames(Y))) {
colnames(Y) <- paste("Y", 1:k, sep = "")
}
xnames <- colnames(X)
ynames <- colnames(Y)
if (is.null(s)) {
s <- sample(1:n, floor(n * train.fraction), replace = F)
}
if (any(is.na(Y))) {
stop("NAs not allowed in outcome variables.")
}
if (shrinkage > 1 | shrinkage <= 0) {
stop("shrinkage should be > 0, < 1")
}
if (train.fraction > 1 | train.fraction <= 0) {
stop("train.fraction should be > 0, < 1")
}
if (bag.fraction > 1 | bag.fraction <= 0) {
stop("bag.fraction should be > 0, < 1")
}
trainerr <- testerr <- vector(length = n.trees)
if (cv.folds > 1) {
ocv <- mvtbCV(Y = Y, X = X, cv.folds = cv.folds, s = s,
save.cv = save.cv, mc.cores = mc.cores, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, seednum = seednum)
best.iters.cv <- ocv$best.iters.cv
cv.err <- ocv$cv.err
out.fit <- ocv$models.k[[cv.folds + 1]]
}
else {
out.fit <- mvtb.fit(Y = Y, X = X, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, s = s, seednum = seednum, ...)
best.iters.cv <- NULL
cv.err <- NULL
ocv <- NULL
}
models <- out.fit$models
trainerr <- out.fit$trainerr
testerr <- out.fit$testerr
best.trees <- list(best.testerr = which.min(testerr), best.cv = best.iters.cv,
last = n.trees)
if (!save.cv) {
ocv <- NULL
}
if (iter.details == T) {
fl <- list(models = models, best.trees = best.trees,
params = params, trainerr = trainerr, testerr = testerr,
cv.err = cv.err, ocv = ocv, s = s, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
else {
fl <- list(models = models, best.trees = best.trees,
params = params, s = s, ocv = ocv, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
if (compress) {
fl <- lapply(fl, comp)
}
class(fl) <- "mvtb"
return(fl)
}
<bytecode: 0x9646e08>
<environment: namespace:mvtboost>
--- function search by body ---
Function mvtb in namespace mvtboost has this body.
----------- END OF FAILURE REPORT --------------
-- 2. Error: mvtb - CV param (@test_cv.R#54) ----------------------------------
the condition has length > 1
Backtrace:
1. mvtboost::mvtb(...)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
mvtboost
--- call from context ---
mvtb(X = X, Y = Y, n.trees = n.trees, shrinkage = 0.5, cv.folds = 3,
compress = F, s = 1:1000, seednum = 1)
--- call from argument ---
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
--- R stacktrace ---
where 1 at testthat/test_cv.R#89: mvtb(X = X, Y = Y, n.trees = n.trees, shrinkage = 0.5, cv.folds = 3,
compress = F, s = 1:1000, seednum = 1)
where 2: eval(code, test_env)
where 3: eval(code, test_env)
where 4: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 5: doTryCatch(return(expr), name, parentenv, handler)
where 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 7: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 8: doTryCatch(return(expr), name, parentenv, handler)
where 9: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 10: tryCatchList(expr, classes, parentenv, handlers)
where 11: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 12: test_code(desc, code, env = parent.frame())
where 13 at testthat/test_cv.R#88: test_that("final_model", {
out <- mvtb(X = X, Y = Y, n.trees = n.trees, shrinkage = 0.5,
cv.folds = 3, compress = F, s = 1:1000, seednum = 1)
out2 <- mvtb(X = X, Y = Y, n.trees = n.trees, shrinkage = 0.5,
cv.folds = 1, compress = F, s = 1:1000, seednum = 1)
out$params <- out2$params
out$best.trees <- out2$best.trees
out$cv.err <- out2$cv.err <- NULL
expect_equal(out, out2)
out <- mvtb(X = X, Y = Y, n.trees = n.trees, shrinkage = 0.5,
cv.folds = 3, compress = F, seednum = 1)
out2 <- mvtb(X = X, Y = Y, n.trees = n.trees, shrinkage = 0.5,
cv.folds = 1, compress = F, seednum = 1)
out$params <- out2$params
out$best.trees <- out2$best.trees
out$cv.err <- out2$cv.err <- NULL
expect_equal(out, out2)
out <- mvtb(X = X, Y = Y, n.trees = n.trees, shrinkage = 0.5,
train.fraction = 0.5, cv.folds = 3, compress = F, seednum = 1)
out2 <- mvtb(X = X, Y = Y, n.trees = n.trees, shrinkage = 0.5,
train.fraction = 0.5, cv.folds = 1, compress = F, seednum = 1)
out$params <- out2$params
out$best.trees <- out2$best.trees
out$cv.err <- out2$cv.err <- NULL
expect_equal(out, out2)
out <- mvtb(X = X, Y = Y, n.trees = n.trees, shrinkage = 0.5,
cv.folds = 3, compress = F, seednum = 1, s = 1:500)
out2 <- mvtb(X = X, Y = Y, n.trees = n.trees, shrinkage = 0.5,
cv.folds = 1, compress = F, seednum = 1, s = 1:500)
out$params <- out2$params
out$best.trees <- out2$best.trees
out$cv.err <- out2$cv.err <- NULL
expect_equal(out, out2)
out <- mvtb(X = X, Y = Y, n.trees = n.trees, shrinkage = 0.5,
cv.folds = 3, compress = F, seednum = 1, bag.fraction = 0.5)
out2 <- mvtb(X = X, Y = Y, n.trees = n.trees, shrinkage = 0.5,
cv.folds = 1, compress = F, seednum = 1, bag.fraction = 0.5)
out$params <- out2$params
out$best.trees <- out2$best.trees
out$cv.err <- out2$cv.err <- NULL
expect_equal(out, out2)
out <- mvtb(X = X, Y = Y, n.trees = n.trees, shrinkage = 0.5,
cv.folds = 3, compress = F, seednum = 1, bag.frac = 0.5,
s = 1:500)
out2 <- mvtb(X = X, Y = Y, n.trees = n.trees, shrinkage = 0.5,
cv.folds = 1, compress = F, seednum = 1, bag.frac = 0.5,
s = 1:500)
out$params <- out2$params
out$best.trees <- out2$best.trees
out$cv.err <- out2$cv.err <- NULL
expect_equal(out, out2)
out <- mvtb(X = X, Y = Y, n.trees = n.trees, shrinkage = 0.5,
cv.folds = 3, compress = F, seednum = 1, bag.frac = 0.5,
train.fraction = 0.5)
out2 <- mvtb(X = X, Y = Y, n.trees = n.trees, shrinkage = 0.5,
cv.folds = 1, compress = F, seednum = 1, bag.frac = 0.5,
train.fraction = 0.5)
out$params <- out2$params
out$best.trees <- out2$best.trees
out$cv.err <- out2$cv.err <- NULL
expect_equal(out, out2)
})
where 14: eval(code, test_env)
where 15: eval(code, test_env)
where 16: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 17: doTryCatch(return(expr), name, parentenv, handler)
where 18: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 19: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 20: doTryCatch(return(expr), name, parentenv, handler)
where 21: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 22: tryCatchList(expr, classes, parentenv, handlers)
where 23: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 24: test_code(NULL, exprs, env)
where 25: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 26: force(code)
where 27: doWithOneRestart(return(expr), restart)
where 28: withOneRestart(expr, restarts[[1L]])
where 29: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 30: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
{
reporter$start_file(basename(path))
lister$start_file(basename(path))
source_file(path, new.env(parent = env), chdir = TRUE,
wrap = wrap)
reporter$.end_context()
reporter$end_file()
})
where 31: FUN(X[[i]], ...)
where 32: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 33: force(code)
where 34: doWithOneRestart(return(expr), restart)
where 35: withOneRestart(expr, restarts[[1L]])
where 36: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 37: with_reporter(reporter = current_reporter, results <- lapply(paths,
test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
load_helpers = FALSE, wrap = wrap))
where 38: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 39: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
wrap = wrap)
where 40: test_package_dir(package = package, test_path = test_path, filter = filter,
reporter = reporter, ..., stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 41: test_check("mvtboost")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (Y, X, n.trees = 100, shrinkage = 0.01, interaction.depth = 1,
distribution = "gaussian", train.fraction = 1, bag.fraction = 1,
cv.folds = 1, s = NULL, seednum = NULL, compress = FALSE,
save.cv = FALSE, iter.details = TRUE, verbose = FALSE, mc.cores = 1,
...)
{
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
if (is.null(ncol(X))) {
X <- as.matrix(X)
}
params <- c(as.list(environment()), list(...))
if (!is.null(seednum)) {
set.seed(seednum)
}
stopifnot(nrow(X) == nrow(Y))
n <- nrow(X)
k <- ncol(Y)
p <- ncol(X)
if (is.null(colnames(X))) {
colnames(X) <- paste("X", 1:p, sep = "")
}
if (is.null(colnames(Y))) {
colnames(Y) <- paste("Y", 1:k, sep = "")
}
xnames <- colnames(X)
ynames <- colnames(Y)
if (is.null(s)) {
s <- sample(1:n, floor(n * train.fraction), replace = F)
}
if (any(is.na(Y))) {
stop("NAs not allowed in outcome variables.")
}
if (shrinkage > 1 | shrinkage <= 0) {
stop("shrinkage should be > 0, < 1")
}
if (train.fraction > 1 | train.fraction <= 0) {
stop("train.fraction should be > 0, < 1")
}
if (bag.fraction > 1 | bag.fraction <= 0) {
stop("bag.fraction should be > 0, < 1")
}
trainerr <- testerr <- vector(length = n.trees)
if (cv.folds > 1) {
ocv <- mvtbCV(Y = Y, X = X, cv.folds = cv.folds, s = s,
save.cv = save.cv, mc.cores = mc.cores, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, seednum = seednum)
best.iters.cv <- ocv$best.iters.cv
cv.err <- ocv$cv.err
out.fit <- ocv$models.k[[cv.folds + 1]]
}
else {
out.fit <- mvtb.fit(Y = Y, X = X, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, s = s, seednum = seednum, ...)
best.iters.cv <- NULL
cv.err <- NULL
ocv <- NULL
}
models <- out.fit$models
trainerr <- out.fit$trainerr
testerr <- out.fit$testerr
best.trees <- list(best.testerr = which.min(testerr), best.cv = best.iters.cv,
last = n.trees)
if (!save.cv) {
ocv <- NULL
}
if (iter.details == T) {
fl <- list(models = models, best.trees = best.trees,
params = params, trainerr = trainerr, testerr = testerr,
cv.err = cv.err, ocv = ocv, s = s, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
else {
fl <- list(models = models, best.trees = best.trees,
params = params, s = s, ocv = ocv, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
if (compress) {
fl <- lapply(fl, comp)
}
class(fl) <- "mvtb"
return(fl)
}
<bytecode: 0x9646e08>
<environment: namespace:mvtboost>
--- function search by body ---
Function mvtb in namespace mvtboost has this body.
----------- END OF FAILURE REPORT --------------
-- 3. Error: final_model (@test_cv.R#89) --------------------------------------
the condition has length > 1
Backtrace:
1. mvtboost::mvtb(...)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
mvtboost
--- call from context ---
mvtb(Y = Y, X = X[, 1:3], n.trees = 500, interaction.depth = 5,
shrinkage = 0.5)
--- call from argument ---
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
--- R stacktrace ---
where 1 at testthat/test_intx.R#16: mvtb(Y = Y, X = X[, 1:3], n.trees = 500, interaction.depth = 5,
shrinkage = 0.5)
where 2: eval(code, test_env)
where 3: eval(code, test_env)
where 4: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 5: doTryCatch(return(expr), name, parentenv, handler)
where 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 7: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 8: doTryCatch(return(expr), name, parentenv, handler)
where 9: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 10: tryCatchList(expr, classes, parentenv, handlers)
where 11: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 12: test_code(NULL, exprs, env)
where 13: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 14: force(code)
where 15: doWithOneRestart(return(expr), restart)
where 16: withOneRestart(expr, restarts[[1L]])
where 17: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 18: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
{
reporter$start_file(basename(path))
lister$start_file(basename(path))
source_file(path, new.env(parent = env), chdir = TRUE,
wrap = wrap)
reporter$.end_context()
reporter$end_file()
})
where 19: FUN(X[[i]], ...)
where 20: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 21: force(code)
where 22: doWithOneRestart(return(expr), restart)
where 23: withOneRestart(expr, restarts[[1L]])
where 24: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 25: with_reporter(reporter = current_reporter, results <- lapply(paths,
test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
load_helpers = FALSE, wrap = wrap))
where 26: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 27: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
wrap = wrap)
where 28: test_package_dir(package = package, test_path = test_path, filter = filter,
reporter = reporter, ..., stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 29: test_check("mvtboost")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (Y, X, n.trees = 100, shrinkage = 0.01, interaction.depth = 1,
distribution = "gaussian", train.fraction = 1, bag.fraction = 1,
cv.folds = 1, s = NULL, seednum = NULL, compress = FALSE,
save.cv = FALSE, iter.details = TRUE, verbose = FALSE, mc.cores = 1,
...)
{
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
if (is.null(ncol(X))) {
X <- as.matrix(X)
}
params <- c(as.list(environment()), list(...))
if (!is.null(seednum)) {
set.seed(seednum)
}
stopifnot(nrow(X) == nrow(Y))
n <- nrow(X)
k <- ncol(Y)
p <- ncol(X)
if (is.null(colnames(X))) {
colnames(X) <- paste("X", 1:p, sep = "")
}
if (is.null(colnames(Y))) {
colnames(Y) <- paste("Y", 1:k, sep = "")
}
xnames <- colnames(X)
ynames <- colnames(Y)
if (is.null(s)) {
s <- sample(1:n, floor(n * train.fraction), replace = F)
}
if (any(is.na(Y))) {
stop("NAs not allowed in outcome variables.")
}
if (shrinkage > 1 | shrinkage <= 0) {
stop("shrinkage should be > 0, < 1")
}
if (train.fraction > 1 | train.fraction <= 0) {
stop("train.fraction should be > 0, < 1")
}
if (bag.fraction > 1 | bag.fraction <= 0) {
stop("bag.fraction should be > 0, < 1")
}
trainerr <- testerr <- vector(length = n.trees)
if (cv.folds > 1) {
ocv <- mvtbCV(Y = Y, X = X, cv.folds = cv.folds, s = s,
save.cv = save.cv, mc.cores = mc.cores, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, seednum = seednum)
best.iters.cv <- ocv$best.iters.cv
cv.err <- ocv$cv.err
out.fit <- ocv$models.k[[cv.folds + 1]]
}
else {
out.fit <- mvtb.fit(Y = Y, X = X, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, s = s, seednum = seednum, ...)
best.iters.cv <- NULL
cv.err <- NULL
ocv <- NULL
}
models <- out.fit$models
trainerr <- out.fit$trainerr
testerr <- out.fit$testerr
best.trees <- list(best.testerr = which.min(testerr), best.cv = best.iters.cv,
last = n.trees)
if (!save.cv) {
ocv <- NULL
}
if (iter.details == T) {
fl <- list(models = models, best.trees = best.trees,
params = params, trainerr = trainerr, testerr = testerr,
cv.err = cv.err, ocv = ocv, s = s, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
else {
fl <- list(models = models, best.trees = best.trees,
params = params, s = s, ocv = ocv, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
if (compress) {
fl <- lapply(fl, comp)
}
class(fl) <- "mvtb"
return(fl)
}
<bytecode: 0x9646e08>
<environment: namespace:mvtboost>
--- function search by body ---
Function mvtb in namespace mvtboost has this body.
----------- END OF FAILURE REPORT --------------
-- 4. Error: (unknown) (@test_intx.R#16) --------------------------------------
the condition has length > 1
Backtrace:
1. mvtboost::mvtb(...)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
mvtboost
--- call from context ---
mvtb(X = X, Y = Y, n.trees = 50)
--- call from argument ---
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
--- R stacktrace ---
where 1 at testthat/test_params.R#13: mvtb(X = X, Y = Y, n.trees = 50)
where 2: eval(code, test_env)
where 3: eval(code, test_env)
where 4: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 5: doTryCatch(return(expr), name, parentenv, handler)
where 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 7: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 8: doTryCatch(return(expr), name, parentenv, handler)
where 9: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 10: tryCatchList(expr, classes, parentenv, handlers)
where 11: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 12: test_code(desc, code, env = parent.frame())
where 13 at testthat/test_params.R#12: test_that("n.trees", {
r <- mvtb(X = X, Y = Y, n.trees = 50)
expect_equal(r$best.trees$last, 50)
})
where 14: eval(code, test_env)
where 15: eval(code, test_env)
where 16: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 17: doTryCatch(return(expr), name, parentenv, handler)
where 18: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 19: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 20: doTryCatch(return(expr), name, parentenv, handler)
where 21: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 22: tryCatchList(expr, classes, parentenv, handlers)
where 23: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 24: test_code(NULL, exprs, env)
where 25: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 26: force(code)
where 27: doWithOneRestart(return(expr), restart)
where 28: withOneRestart(expr, restarts[[1L]])
where 29: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 30: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
{
reporter$start_file(basename(path))
lister$start_file(basename(path))
source_file(path, new.env(parent = env), chdir = TRUE,
wrap = wrap)
reporter$.end_context()
reporter$end_file()
})
where 31: FUN(X[[i]], ...)
where 32: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 33: force(code)
where 34: doWithOneRestart(return(expr), restart)
where 35: withOneRestart(expr, restarts[[1L]])
where 36: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 37: with_reporter(reporter = current_reporter, results <- lapply(paths,
test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
load_helpers = FALSE, wrap = wrap))
where 38: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 39: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
wrap = wrap)
where 40: test_package_dir(package = package, test_path = test_path, filter = filter,
reporter = reporter, ..., stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 41: test_check("mvtboost")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (Y, X, n.trees = 100, shrinkage = 0.01, interaction.depth = 1,
distribution = "gaussian", train.fraction = 1, bag.fraction = 1,
cv.folds = 1, s = NULL, seednum = NULL, compress = FALSE,
save.cv = FALSE, iter.details = TRUE, verbose = FALSE, mc.cores = 1,
...)
{
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
if (is.null(ncol(X))) {
X <- as.matrix(X)
}
params <- c(as.list(environment()), list(...))
if (!is.null(seednum)) {
set.seed(seednum)
}
stopifnot(nrow(X) == nrow(Y))
n <- nrow(X)
k <- ncol(Y)
p <- ncol(X)
if (is.null(colnames(X))) {
colnames(X) <- paste("X", 1:p, sep = "")
}
if (is.null(colnames(Y))) {
colnames(Y) <- paste("Y", 1:k, sep = "")
}
xnames <- colnames(X)
ynames <- colnames(Y)
if (is.null(s)) {
s <- sample(1:n, floor(n * train.fraction), replace = F)
}
if (any(is.na(Y))) {
stop("NAs not allowed in outcome variables.")
}
if (shrinkage > 1 | shrinkage <= 0) {
stop("shrinkage should be > 0, < 1")
}
if (train.fraction > 1 | train.fraction <= 0) {
stop("train.fraction should be > 0, < 1")
}
if (bag.fraction > 1 | bag.fraction <= 0) {
stop("bag.fraction should be > 0, < 1")
}
trainerr <- testerr <- vector(length = n.trees)
if (cv.folds > 1) {
ocv <- mvtbCV(Y = Y, X = X, cv.folds = cv.folds, s = s,
save.cv = save.cv, mc.cores = mc.cores, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, seednum = seednum)
best.iters.cv <- ocv$best.iters.cv
cv.err <- ocv$cv.err
out.fit <- ocv$models.k[[cv.folds + 1]]
}
else {
out.fit <- mvtb.fit(Y = Y, X = X, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, s = s, seednum = seednum, ...)
best.iters.cv <- NULL
cv.err <- NULL
ocv <- NULL
}
models <- out.fit$models
trainerr <- out.fit$trainerr
testerr <- out.fit$testerr
best.trees <- list(best.testerr = which.min(testerr), best.cv = best.iters.cv,
last = n.trees)
if (!save.cv) {
ocv <- NULL
}
if (iter.details == T) {
fl <- list(models = models, best.trees = best.trees,
params = params, trainerr = trainerr, testerr = testerr,
cv.err = cv.err, ocv = ocv, s = s, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
else {
fl <- list(models = models, best.trees = best.trees,
params = params, s = s, ocv = ocv, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
if (compress) {
fl <- lapply(fl, comp)
}
class(fl) <- "mvtb"
return(fl)
}
<bytecode: 0x9646e08>
<environment: namespace:mvtboost>
--- function search by body ---
Function mvtb in namespace mvtboost has this body.
----------- END OF FAILURE REPORT --------------
-- 5. Error: n.trees (@test_params.R#13) --------------------------------------
the condition has length > 1
Backtrace:
1. mvtboost::mvtb(X = X, Y = Y, n.trees = 50)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
mvtboost
--- call from context ---
mvtb(X = X, Y = Y, n.trees = 1, train.fraction = i)
--- call from argument ---
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
--- R stacktrace ---
where 1 at testthat/test_params.R#19: mvtb(X = X, Y = Y, n.trees = 1, train.fraction = i)
where 2: eval(code, test_env)
where 3: eval(code, test_env)
where 4: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 5: doTryCatch(return(expr), name, parentenv, handler)
where 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 7: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 8: doTryCatch(return(expr), name, parentenv, handler)
where 9: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 10: tryCatchList(expr, classes, parentenv, handlers)
where 11: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 12: test_code(desc, code, env = parent.frame())
where 13 at testthat/test_params.R#17: test_that("train.fraction", {
for (i in seq(0.1, 0.9, by = 0.1)) {
r <- mvtb(X = X, Y = Y, n.trees = 1, train.fraction = i)
expect_equal(r$models[[1]]$nTrain, floor(n * i))
}
})
where 14: eval(code, test_env)
where 15: eval(code, test_env)
where 16: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 17: doTryCatch(return(expr), name, parentenv, handler)
where 18: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 19: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 20: doTryCatch(return(expr), name, parentenv, handler)
where 21: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 22: tryCatchList(expr, classes, parentenv, handlers)
where 23: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 24: test_code(NULL, exprs, env)
where 25: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 26: force(code)
where 27: doWithOneRestart(return(expr), restart)
where 28: withOneRestart(expr, restarts[[1L]])
where 29: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 30: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
{
reporter$start_file(basename(path))
lister$start_file(basename(path))
source_file(path, new.env(parent = env), chdir = TRUE,
wrap = wrap)
reporter$.end_context()
reporter$end_file()
})
where 31: FUN(X[[i]], ...)
where 32: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 33: force(code)
where 34: doWithOneRestart(return(expr), restart)
where 35: withOneRestart(expr, restarts[[1L]])
where 36: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 37: with_reporter(reporter = current_reporter, results <- lapply(paths,
test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
load_helpers = FALSE, wrap = wrap))
where 38: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 39: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
wrap = wrap)
where 40: test_package_dir(package = package, test_path = test_path, filter = filter,
reporter = reporter, ..., stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 41: test_check("mvtboost")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (Y, X, n.trees = 100, shrinkage = 0.01, interaction.depth = 1,
distribution = "gaussian", train.fraction = 1, bag.fraction = 1,
cv.folds = 1, s = NULL, seednum = NULL, compress = FALSE,
save.cv = FALSE, iter.details = TRUE, verbose = FALSE, mc.cores = 1,
...)
{
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
if (is.null(ncol(X))) {
X <- as.matrix(X)
}
params <- c(as.list(environment()), list(...))
if (!is.null(seednum)) {
set.seed(seednum)
}
stopifnot(nrow(X) == nrow(Y))
n <- nrow(X)
k <- ncol(Y)
p <- ncol(X)
if (is.null(colnames(X))) {
colnames(X) <- paste("X", 1:p, sep = "")
}
if (is.null(colnames(Y))) {
colnames(Y) <- paste("Y", 1:k, sep = "")
}
xnames <- colnames(X)
ynames <- colnames(Y)
if (is.null(s)) {
s <- sample(1:n, floor(n * train.fraction), replace = F)
}
if (any(is.na(Y))) {
stop("NAs not allowed in outcome variables.")
}
if (shrinkage > 1 | shrinkage <= 0) {
stop("shrinkage should be > 0, < 1")
}
if (train.fraction > 1 | train.fraction <= 0) {
stop("train.fraction should be > 0, < 1")
}
if (bag.fraction > 1 | bag.fraction <= 0) {
stop("bag.fraction should be > 0, < 1")
}
trainerr <- testerr <- vector(length = n.trees)
if (cv.folds > 1) {
ocv <- mvtbCV(Y = Y, X = X, cv.folds = cv.folds, s = s,
save.cv = save.cv, mc.cores = mc.cores, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, seednum = seednum)
best.iters.cv <- ocv$best.iters.cv
cv.err <- ocv$cv.err
out.fit <- ocv$models.k[[cv.folds + 1]]
}
else {
out.fit <- mvtb.fit(Y = Y, X = X, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, s = s, seednum = seednum, ...)
best.iters.cv <- NULL
cv.err <- NULL
ocv <- NULL
}
models <- out.fit$models
trainerr <- out.fit$trainerr
testerr <- out.fit$testerr
best.trees <- list(best.testerr = which.min(testerr), best.cv = best.iters.cv,
last = n.trees)
if (!save.cv) {
ocv <- NULL
}
if (iter.details == T) {
fl <- list(models = models, best.trees = best.trees,
params = params, trainerr = trainerr, testerr = testerr,
cv.err = cv.err, ocv = ocv, s = s, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
else {
fl <- list(models = models, best.trees = best.trees,
params = params, s = s, ocv = ocv, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
if (compress) {
fl <- lapply(fl, comp)
}
class(fl) <- "mvtb"
return(fl)
}
<bytecode: 0x9646e08>
<environment: namespace:mvtboost>
--- function search by body ---
Function mvtb in namespace mvtboost has this body.
----------- END OF FAILURE REPORT --------------
-- 6. Error: train.fraction (@test_params.R#19) -------------------------------
the condition has length > 1
Backtrace:
1. mvtboost::mvtb(X = X, Y = Y, n.trees = 1, train.fraction = i)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
mvtboost
--- call from context ---
mvtb(X = X, Y = Y, n.trees = 10, train.fraction = 1, bag.fraction = 0.5)
--- call from argument ---
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
--- R stacktrace ---
where 1 at testthat/test_params.R#25: mvtb(X = X, Y = Y, n.trees = 10, train.fraction = 1, bag.fraction = 0.5)
where 2: eval(code, test_env)
where 3: eval(code, test_env)
where 4: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 5: doTryCatch(return(expr), name, parentenv, handler)
where 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 7: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 8: doTryCatch(return(expr), name, parentenv, handler)
where 9: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 10: tryCatchList(expr, classes, parentenv, handlers)
where 11: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 12: test_code(desc, code, env = parent.frame())
where 13 at testthat/test_params.R#24: test_that("bag.fraction", {
r <- mvtb(X = X, Y = Y, n.trees = 10, train.fraction = 1,
bag.fraction = 0.5)
for (i in 1:4) {
expect_equal(r$models[[i]]$bag.fraction, 0.5)
}
})
where 14: eval(code, test_env)
where 15: eval(code, test_env)
where 16: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 17: doTryCatch(return(expr), name, parentenv, handler)
where 18: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 19: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 20: doTryCatch(return(expr), name, parentenv, handler)
where 21: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 22: tryCatchList(expr, classes, parentenv, handlers)
where 23: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 24: test_code(NULL, exprs, env)
where 25: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 26: force(code)
where 27: doWithOneRestart(return(expr), restart)
where 28: withOneRestart(expr, restarts[[1L]])
where 29: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 30: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
{
reporter$start_file(basename(path))
lister$start_file(basename(path))
source_file(path, new.env(parent = env), chdir = TRUE,
wrap = wrap)
reporter$.end_context()
reporter$end_file()
})
where 31: FUN(X[[i]], ...)
where 32: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 33: force(code)
where 34: doWithOneRestart(return(expr), restart)
where 35: withOneRestart(expr, restarts[[1L]])
where 36: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 37: with_reporter(reporter = current_reporter, results <- lapply(paths,
test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
load_helpers = FALSE, wrap = wrap))
where 38: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 39: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
wrap = wrap)
where 40: test_package_dir(package = package, test_path = test_path, filter = filter,
reporter = reporter, ..., stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 41: test_check("mvtboost")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (Y, X, n.trees = 100, shrinkage = 0.01, interaction.depth = 1,
distribution = "gaussian", train.fraction = 1, bag.fraction = 1,
cv.folds = 1, s = NULL, seednum = NULL, compress = FALSE,
save.cv = FALSE, iter.details = TRUE, verbose = FALSE, mc.cores = 1,
...)
{
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
if (is.null(ncol(X))) {
X <- as.matrix(X)
}
params <- c(as.list(environment()), list(...))
if (!is.null(seednum)) {
set.seed(seednum)
}
stopifnot(nrow(X) == nrow(Y))
n <- nrow(X)
k <- ncol(Y)
p <- ncol(X)
if (is.null(colnames(X))) {
colnames(X) <- paste("X", 1:p, sep = "")
}
if (is.null(colnames(Y))) {
colnames(Y) <- paste("Y", 1:k, sep = "")
}
xnames <- colnames(X)
ynames <- colnames(Y)
if (is.null(s)) {
s <- sample(1:n, floor(n * train.fraction), replace = F)
}
if (any(is.na(Y))) {
stop("NAs not allowed in outcome variables.")
}
if (shrinkage > 1 | shrinkage <= 0) {
stop("shrinkage should be > 0, < 1")
}
if (train.fraction > 1 | train.fraction <= 0) {
stop("train.fraction should be > 0, < 1")
}
if (bag.fraction > 1 | bag.fraction <= 0) {
stop("bag.fraction should be > 0, < 1")
}
trainerr <- testerr <- vector(length = n.trees)
if (cv.folds > 1) {
ocv <- mvtbCV(Y = Y, X = X, cv.folds = cv.folds, s = s,
save.cv = save.cv, mc.cores = mc.cores, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, seednum = seednum)
best.iters.cv <- ocv$best.iters.cv
cv.err <- ocv$cv.err
out.fit <- ocv$models.k[[cv.folds + 1]]
}
else {
out.fit <- mvtb.fit(Y = Y, X = X, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, s = s, seednum = seednum, ...)
best.iters.cv <- NULL
cv.err <- NULL
ocv <- NULL
}
models <- out.fit$models
trainerr <- out.fit$trainerr
testerr <- out.fit$testerr
best.trees <- list(best.testerr = which.min(testerr), best.cv = best.iters.cv,
last = n.trees)
if (!save.cv) {
ocv <- NULL
}
if (iter.details == T) {
fl <- list(models = models, best.trees = best.trees,
params = params, trainerr = trainerr, testerr = testerr,
cv.err = cv.err, ocv = ocv, s = s, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
else {
fl <- list(models = models, best.trees = best.trees,
params = params, s = s, ocv = ocv, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
if (compress) {
fl <- lapply(fl, comp)
}
class(fl) <- "mvtb"
return(fl)
}
<bytecode: 0x9646e08>
<environment: namespace:mvtboost>
--- function search by body ---
Function mvtb in namespace mvtboost has this body.
----------- END OF FAILURE REPORT --------------
-- 7. Error: bag.fraction (@test_params.R#25) ---------------------------------
the condition has length > 1
Backtrace:
1. mvtboost::mvtb(...)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
mvtboost
--- call from context ---
mvtb(X = X, Y = Y, n.trees = 5, train.fraction = 0.5, bag.fraction = 0.5,
s = 1:500, save.cv = TRUE)
--- call from argument ---
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
--- R stacktrace ---
where 1 at testthat/test_params.R#30: mvtb(X = X, Y = Y, n.trees = 5, train.fraction = 0.5, bag.fraction = 0.5,
s = 1:500, save.cv = TRUE)
where 2: eval(code, test_env)
where 3: eval(code, test_env)
where 4: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 5: doTryCatch(return(expr), name, parentenv, handler)
where 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 7: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 8: doTryCatch(return(expr), name, parentenv, handler)
where 9: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 10: tryCatchList(expr, classes, parentenv, handlers)
where 11: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 12: test_code(desc, code, env = parent.frame())
where 13 at testthat/test_params.R#29: test_that("subsetting", {
r <- mvtb(X = X, Y = Y, n.trees = 5, train.fraction = 0.5,
bag.fraction = 0.5, s = 1:500, save.cv = TRUE)
expect_equal(r$s, 1:500)
})
where 14: eval(code, test_env)
where 15: eval(code, test_env)
where 16: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 17: doTryCatch(return(expr), name, parentenv, handler)
where 18: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 19: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 20: doTryCatch(return(expr), name, parentenv, handler)
where 21: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 22: tryCatchList(expr, classes, parentenv, handlers)
where 23: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 24: test_code(NULL, exprs, env)
where 25: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 26: force(code)
where 27: doWithOneRestart(return(expr), restart)
where 28: withOneRestart(expr, restarts[[1L]])
where 29: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 30: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
{
reporter$start_file(basename(path))
lister$start_file(basename(path))
source_file(path, new.env(parent = env), chdir = TRUE,
wrap = wrap)
reporter$.end_context()
reporter$end_file()
})
where 31: FUN(X[[i]], ...)
where 32: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 33: force(code)
where 34: doWithOneRestart(return(expr), restart)
where 35: withOneRestart(expr, restarts[[1L]])
where 36: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 37: with_reporter(reporter = current_reporter, results <- lapply(paths,
test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
load_helpers = FALSE, wrap = wrap))
where 38: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 39: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
wrap = wrap)
where 40: test_package_dir(package = package, test_path = test_path, filter = filter,
reporter = reporter, ..., stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 41: test_check("mvtboost")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (Y, X, n.trees = 100, shrinkage = 0.01, interaction.depth = 1,
distribution = "gaussian", train.fraction = 1, bag.fraction = 1,
cv.folds = 1, s = NULL, seednum = NULL, compress = FALSE,
save.cv = FALSE, iter.details = TRUE, verbose = FALSE, mc.cores = 1,
...)
{
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
if (is.null(ncol(X))) {
X <- as.matrix(X)
}
params <- c(as.list(environment()), list(...))
if (!is.null(seednum)) {
set.seed(seednum)
}
stopifnot(nrow(X) == nrow(Y))
n <- nrow(X)
k <- ncol(Y)
p <- ncol(X)
if (is.null(colnames(X))) {
colnames(X) <- paste("X", 1:p, sep = "")
}
if (is.null(colnames(Y))) {
colnames(Y) <- paste("Y", 1:k, sep = "")
}
xnames <- colnames(X)
ynames <- colnames(Y)
if (is.null(s)) {
s <- sample(1:n, floor(n * train.fraction), replace = F)
}
if (any(is.na(Y))) {
stop("NAs not allowed in outcome variables.")
}
if (shrinkage > 1 | shrinkage <= 0) {
stop("shrinkage should be > 0, < 1")
}
if (train.fraction > 1 | train.fraction <= 0) {
stop("train.fraction should be > 0, < 1")
}
if (bag.fraction > 1 | bag.fraction <= 0) {
stop("bag.fraction should be > 0, < 1")
}
trainerr <- testerr <- vector(length = n.trees)
if (cv.folds > 1) {
ocv <- mvtbCV(Y = Y, X = X, cv.folds = cv.folds, s = s,
save.cv = save.cv, mc.cores = mc.cores, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, seednum = seednum)
best.iters.cv <- ocv$best.iters.cv
cv.err <- ocv$cv.err
out.fit <- ocv$models.k[[cv.folds + 1]]
}
else {
out.fit <- mvtb.fit(Y = Y, X = X, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, s = s, seednum = seednum, ...)
best.iters.cv <- NULL
cv.err <- NULL
ocv <- NULL
}
models <- out.fit$models
trainerr <- out.fit$trainerr
testerr <- out.fit$testerr
best.trees <- list(best.testerr = which.min(testerr), best.cv = best.iters.cv,
last = n.trees)
if (!save.cv) {
ocv <- NULL
}
if (iter.details == T) {
fl <- list(models = models, best.trees = best.trees,
params = params, trainerr = trainerr, testerr = testerr,
cv.err = cv.err, ocv = ocv, s = s, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
else {
fl <- list(models = models, best.trees = best.trees,
params = params, s = s, ocv = ocv, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
if (compress) {
fl <- lapply(fl, comp)
}
class(fl) <- "mvtb"
return(fl)
}
<bytecode: 0x9646e08>
<environment: namespace:mvtboost>
--- function search by body ---
Function mvtb in namespace mvtboost has this body.
----------- END OF FAILURE REPORT --------------
-- 8. Error: subsetting (@test_params.R#30) -----------------------------------
the condition has length > 1
Backtrace:
1. mvtboost::mvtb(...)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
mvtboost
--- call from context ---
mvtb(X = X, Y = Y, n.trees = 5, train.fraction = 0.5, bag.fraction = 0.5,
s = 1:500, seednum = 8)
--- call from argument ---
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
--- R stacktrace ---
where 1 at testthat/test_params.R#35: mvtb(X = X, Y = Y, n.trees = 5, train.fraction = 0.5, bag.fraction = 0.5,
s = 1:500, seednum = 8)
where 2: eval(code, test_env)
where 3: eval(code, test_env)
where 4: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 5: doTryCatch(return(expr), name, parentenv, handler)
where 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 7: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 8: doTryCatch(return(expr), name, parentenv, handler)
where 9: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 10: tryCatchList(expr, classes, parentenv, handlers)
where 11: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 12: test_code(desc, code, env = parent.frame())
where 13 at testthat/test_params.R#34: test_that("seednum", {
r <- mvtb(X = X, Y = Y, n.trees = 5, train.fraction = 0.5,
bag.fraction = 0.5, s = 1:500, seednum = 8)
expect_equal(r$params$seednum, 8)
r2 <- mvtb(X = X, Y = Y, n.trees = 5, train.fraction = 0.5,
bag.fraction = 0.5, s = 1:500, seednum = 8)
expect_equal(r, r2)
r3 <- mvtb(X = X, Y = Y, n.trees = 5, train.fraction = 0.5,
bag.fraction = 0.5, s = 1:500, seednum = 9)
expect_true(!identical(r, r3))
})
where 14: eval(code, test_env)
where 15: eval(code, test_env)
where 16: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 17: doTryCatch(return(expr), name, parentenv, handler)
where 18: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 19: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 20: doTryCatch(return(expr), name, parentenv, handler)
where 21: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 22: tryCatchList(expr, classes, parentenv, handlers)
where 23: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 24: test_code(NULL, exprs, env)
where 25: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 26: force(code)
where 27: doWithOneRestart(return(expr), restart)
where 28: withOneRestart(expr, restarts[[1L]])
where 29: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 30: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
{
reporter$start_file(basename(path))
lister$start_file(basename(path))
source_file(path, new.env(parent = env), chdir = TRUE,
wrap = wrap)
reporter$.end_context()
reporter$end_file()
})
where 31: FUN(X[[i]], ...)
where 32: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 33: force(code)
where 34: doWithOneRestart(return(expr), restart)
where 35: withOneRestart(expr, restarts[[1L]])
where 36: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 37: with_reporter(reporter = current_reporter, results <- lapply(paths,
test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
load_helpers = FALSE, wrap = wrap))
where 38: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 39: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
wrap = wrap)
where 40: test_package_dir(package = package, test_path = test_path, filter = filter,
reporter = reporter, ..., stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 41: test_check("mvtboost")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (Y, X, n.trees = 100, shrinkage = 0.01, interaction.depth = 1,
distribution = "gaussian", train.fraction = 1, bag.fraction = 1,
cv.folds = 1, s = NULL, seednum = NULL, compress = FALSE,
save.cv = FALSE, iter.details = TRUE, verbose = FALSE, mc.cores = 1,
...)
{
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
if (is.null(ncol(X))) {
X <- as.matrix(X)
}
params <- c(as.list(environment()), list(...))
if (!is.null(seednum)) {
set.seed(seednum)
}
stopifnot(nrow(X) == nrow(Y))
n <- nrow(X)
k <- ncol(Y)
p <- ncol(X)
if (is.null(colnames(X))) {
colnames(X) <- paste("X", 1:p, sep = "")
}
if (is.null(colnames(Y))) {
colnames(Y) <- paste("Y", 1:k, sep = "")
}
xnames <- colnames(X)
ynames <- colnames(Y)
if (is.null(s)) {
s <- sample(1:n, floor(n * train.fraction), replace = F)
}
if (any(is.na(Y))) {
stop("NAs not allowed in outcome variables.")
}
if (shrinkage > 1 | shrinkage <= 0) {
stop("shrinkage should be > 0, < 1")
}
if (train.fraction > 1 | train.fraction <= 0) {
stop("train.fraction should be > 0, < 1")
}
if (bag.fraction > 1 | bag.fraction <= 0) {
stop("bag.fraction should be > 0, < 1")
}
trainerr <- testerr <- vector(length = n.trees)
if (cv.folds > 1) {
ocv <- mvtbCV(Y = Y, X = X, cv.folds = cv.folds, s = s,
save.cv = save.cv, mc.cores = mc.cores, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, seednum = seednum)
best.iters.cv <- ocv$best.iters.cv
cv.err <- ocv$cv.err
out.fit <- ocv$models.k[[cv.folds + 1]]
}
else {
out.fit <- mvtb.fit(Y = Y, X = X, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, s = s, seednum = seednum, ...)
best.iters.cv <- NULL
cv.err <- NULL
ocv <- NULL
}
models <- out.fit$models
trainerr <- out.fit$trainerr
testerr <- out.fit$testerr
best.trees <- list(best.testerr = which.min(testerr), best.cv = best.iters.cv,
last = n.trees)
if (!save.cv) {
ocv <- NULL
}
if (iter.details == T) {
fl <- list(models = models, best.trees = best.trees,
params = params, trainerr = trainerr, testerr = testerr,
cv.err = cv.err, ocv = ocv, s = s, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
else {
fl <- list(models = models, best.trees = best.trees,
params = params, s = s, ocv = ocv, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
if (compress) {
fl <- lapply(fl, comp)
}
class(fl) <- "mvtb"
return(fl)
}
<bytecode: 0x9646e08>
<environment: namespace:mvtboost>
--- function search by body ---
Function mvtb in namespace mvtboost has this body.
----------- END OF FAILURE REPORT --------------
-- 9. Error: seednum (@test_params.R#35) --------------------------------------
the condition has length > 1
Backtrace:
1. mvtboost::mvtb(...)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
mvtboost
--- call from context ---
mvtb(X = X, Y = Y, n.trees = 5, train.fraction = 0.5, bag.fraction = 0.5,
s = 1:500, seednum = 8, compress = FALSE)
--- call from argument ---
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
--- R stacktrace ---
where 1 at testthat/test_params.R#44: mvtb(X = X, Y = Y, n.trees = 5, train.fraction = 0.5, bag.fraction = 0.5,
s = 1:500, seednum = 8, compress = FALSE)
where 2: eval(code, test_env)
where 3: eval(code, test_env)
where 4: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 5: doTryCatch(return(expr), name, parentenv, handler)
where 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 7: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 8: doTryCatch(return(expr), name, parentenv, handler)
where 9: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 10: tryCatchList(expr, classes, parentenv, handlers)
where 11: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 12: test_code(desc, code, env = parent.frame())
where 13 at testthat/test_params.R#43: test_that("compress", {
r <- mvtb(X = X, Y = Y, n.trees = 5, train.fraction = 0.5,
bag.fraction = 0.5, s = 1:500, seednum = 8, compress = FALSE)
expect_true(all(!(unlist(lapply(r, class)) %in% "raw")))
r <- mvtb(X = X, Y = Y, n.trees = 5, train.fraction = 0.5,
bag.fraction = 0.5, s = 1:500, seednum = 8, compress = TRUE)
expect_equal_to_reference(unlist(lapply(r, class)), "raw")
r <- mvtb(X = X, Y = Y, n.trees = 5, train.fraction = 0.5,
bag.fraction = 0.5, s = 1:500, seednum = 8, compress = FALSE,
cv.folds = 3, save.cv = T)
expect_true(all(!(unlist(lapply(r, class)) %in% "raw")))
expect_true(all(!(unlist(lapply(r$ocv, class)) %in% "raw")))
r1 <- mvtb(X = X, Y = Y, n.trees = 5, train.fraction = 0.5,
bag.fraction = 0.5, s = 1:500, seednum = 8, compress = TRUE,
cv.folds = 3, save.cv = T)
expect_equal_to_reference(unlist(lapply(r1, class)), "raw")
expect_equal(class(r1$ocv), "raw")
expect_lt(object.size(r1), object.size(r))
})
where 14: eval(code, test_env)
where 15: eval(code, test_env)
where 16: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 17: doTryCatch(return(expr), name, parentenv, handler)
where 18: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 19: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 20: doTryCatch(return(expr), name, parentenv, handler)
where 21: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 22: tryCatchList(expr, classes, parentenv, handlers)
where 23: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 24: test_code(NULL, exprs, env)
where 25: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 26: force(code)
where 27: doWithOneRestart(return(expr), restart)
where 28: withOneRestart(expr, restarts[[1L]])
where 29: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 30: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
{
reporter$start_file(basename(path))
lister$start_file(basename(path))
source_file(path, new.env(parent = env), chdir = TRUE,
wrap = wrap)
reporter$.end_context()
reporter$end_file()
})
where 31: FUN(X[[i]], ...)
where 32: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 33: force(code)
where 34: doWithOneRestart(return(expr), restart)
where 35: withOneRestart(expr, restarts[[1L]])
where 36: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 37: with_reporter(reporter = current_reporter, results <- lapply(paths,
test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
load_helpers = FALSE, wrap = wrap))
where 38: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 39: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
wrap = wrap)
where 40: test_package_dir(package = package, test_path = test_path, filter = filter,
reporter = reporter, ..., stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 41: test_check("mvtboost")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (Y, X, n.trees = 100, shrinkage = 0.01, interaction.depth = 1,
distribution = "gaussian", train.fraction = 1, bag.fraction = 1,
cv.folds = 1, s = NULL, seednum = NULL, compress = FALSE,
save.cv = FALSE, iter.details = TRUE, verbose = FALSE, mc.cores = 1,
...)
{
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
if (is.null(ncol(X))) {
X <- as.matrix(X)
}
params <- c(as.list(environment()), list(...))
if (!is.null(seednum)) {
set.seed(seednum)
}
stopifnot(nrow(X) == nrow(Y))
n <- nrow(X)
k <- ncol(Y)
p <- ncol(X)
if (is.null(colnames(X))) {
colnames(X) <- paste("X", 1:p, sep = "")
}
if (is.null(colnames(Y))) {
colnames(Y) <- paste("Y", 1:k, sep = "")
}
xnames <- colnames(X)
ynames <- colnames(Y)
if (is.null(s)) {
s <- sample(1:n, floor(n * train.fraction), replace = F)
}
if (any(is.na(Y))) {
stop("NAs not allowed in outcome variables.")
}
if (shrinkage > 1 | shrinkage <= 0) {
stop("shrinkage should be > 0, < 1")
}
if (train.fraction > 1 | train.fraction <= 0) {
stop("train.fraction should be > 0, < 1")
}
if (bag.fraction > 1 | bag.fraction <= 0) {
stop("bag.fraction should be > 0, < 1")
}
trainerr <- testerr <- vector(length = n.trees)
if (cv.folds > 1) {
ocv <- mvtbCV(Y = Y, X = X, cv.folds = cv.folds, s = s,
save.cv = save.cv, mc.cores = mc.cores, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, seednum = seednum)
best.iters.cv <- ocv$best.iters.cv
cv.err <- ocv$cv.err
out.fit <- ocv$models.k[[cv.folds + 1]]
}
else {
out.fit <- mvtb.fit(Y = Y, X = X, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, s = s, seednum = seednum, ...)
best.iters.cv <- NULL
cv.err <- NULL
ocv <- NULL
}
models <- out.fit$models
trainerr <- out.fit$trainerr
testerr <- out.fit$testerr
best.trees <- list(best.testerr = which.min(testerr), best.cv = best.iters.cv,
last = n.trees)
if (!save.cv) {
ocv <- NULL
}
if (iter.details == T) {
fl <- list(models = models, best.trees = best.trees,
params = params, trainerr = trainerr, testerr = testerr,
cv.err = cv.err, ocv = ocv, s = s, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
else {
fl <- list(models = models, best.trees = best.trees,
params = params, s = s, ocv = ocv, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
if (compress) {
fl <- lapply(fl, comp)
}
class(fl) <- "mvtb"
return(fl)
}
<bytecode: 0x9646e08>
<environment: namespace:mvtboost>
--- function search by body ---
Function mvtb in namespace mvtboost has this body.
----------- END OF FAILURE REPORT --------------
-- 10. Error: compress (@test_params.R#44) ------------------------------------
the condition has length > 1
Backtrace:
1. mvtboost::mvtb(...)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
mvtboost
--- call from context ---
mvtb(X = X, Y = Y, n.trees = 5, seednum = 8, compress = TRUE)
--- call from argument ---
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
--- R stacktrace ---
where 1 at testthat/test_params.R#58: mvtb(X = X, Y = Y, n.trees = 5, seednum = 8, compress = TRUE)
where 2: eval(code, test_env)
where 3: eval(code, test_env)
where 4: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 5: doTryCatch(return(expr), name, parentenv, handler)
where 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 7: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 8: doTryCatch(return(expr), name, parentenv, handler)
where 9: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 10: tryCatchList(expr, classes, parentenv, handlers)
where 11: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 12: test_code(desc, code, env = parent.frame())
where 13 at testthat/test_params.R#57: test_that("mvtb.uncomp", {
rc <- mvtb(X = X, Y = Y, n.trees = 5, seednum = 8, compress = TRUE)
r <- mvtb(X = X, Y = Y, n.trees = 5, seednum = 8, compress = FALSE)
r2 <- mvtb.uncomp(rc)
r$params$compress <- TRUE
expect_equal(r, r2)
})
where 14: eval(code, test_env)
where 15: eval(code, test_env)
where 16: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 17: doTryCatch(return(expr), name, parentenv, handler)
where 18: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 19: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 20: doTryCatch(return(expr), name, parentenv, handler)
where 21: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 22: tryCatchList(expr, classes, parentenv, handlers)
where 23: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 24: test_code(NULL, exprs, env)
where 25: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 26: force(code)
where 27: doWithOneRestart(return(expr), restart)
where 28: withOneRestart(expr, restarts[[1L]])
where 29: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 30: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
{
reporter$start_file(basename(path))
lister$start_file(basename(path))
source_file(path, new.env(parent = env), chdir = TRUE,
wrap = wrap)
reporter$.end_context()
reporter$end_file()
})
where 31: FUN(X[[i]], ...)
where 32: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 33: force(code)
where 34: doWithOneRestart(return(expr), restart)
where 35: withOneRestart(expr, restarts[[1L]])
where 36: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 37: with_reporter(reporter = current_reporter, results <- lapply(paths,
test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
load_helpers = FALSE, wrap = wrap))
where 38: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 39: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
wrap = wrap)
where 40: test_package_dir(package = package, test_path = test_path, filter = filter,
reporter = reporter, ..., stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 41: test_check("mvtboost")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (Y, X, n.trees = 100, shrinkage = 0.01, interaction.depth = 1,
distribution = "gaussian", train.fraction = 1, bag.fraction = 1,
cv.folds = 1, s = NULL, seednum = NULL, compress = FALSE,
save.cv = FALSE, iter.details = TRUE, verbose = FALSE, mc.cores = 1,
...)
{
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
if (is.null(ncol(X))) {
X <- as.matrix(X)
}
params <- c(as.list(environment()), list(...))
if (!is.null(seednum)) {
set.seed(seednum)
}
stopifnot(nrow(X) == nrow(Y))
n <- nrow(X)
k <- ncol(Y)
p <- ncol(X)
if (is.null(colnames(X))) {
colnames(X) <- paste("X", 1:p, sep = "")
}
if (is.null(colnames(Y))) {
colnames(Y) <- paste("Y", 1:k, sep = "")
}
xnames <- colnames(X)
ynames <- colnames(Y)
if (is.null(s)) {
s <- sample(1:n, floor(n * train.fraction), replace = F)
}
if (any(is.na(Y))) {
stop("NAs not allowed in outcome variables.")
}
if (shrinkage > 1 | shrinkage <= 0) {
stop("shrinkage should be > 0, < 1")
}
if (train.fraction > 1 | train.fraction <= 0) {
stop("train.fraction should be > 0, < 1")
}
if (bag.fraction > 1 | bag.fraction <= 0) {
stop("bag.fraction should be > 0, < 1")
}
trainerr <- testerr <- vector(length = n.trees)
if (cv.folds > 1) {
ocv <- mvtbCV(Y = Y, X = X, cv.folds = cv.folds, s = s,
save.cv = save.cv, mc.cores = mc.cores, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, seednum = seednum)
best.iters.cv <- ocv$best.iters.cv
cv.err <- ocv$cv.err
out.fit <- ocv$models.k[[cv.folds + 1]]
}
else {
out.fit <- mvtb.fit(Y = Y, X = X, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, s = s, seednum = seednum, ...)
best.iters.cv <- NULL
cv.err <- NULL
ocv <- NULL
}
models <- out.fit$models
trainerr <- out.fit$trainerr
testerr <- out.fit$testerr
best.trees <- list(best.testerr = which.min(testerr), best.cv = best.iters.cv,
last = n.trees)
if (!save.cv) {
ocv <- NULL
}
if (iter.details == T) {
fl <- list(models = models, best.trees = best.trees,
params = params, trainerr = trainerr, testerr = testerr,
cv.err = cv.err, ocv = ocv, s = s, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
else {
fl <- list(models = models, best.trees = best.trees,
params = params, s = s, ocv = ocv, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
if (compress) {
fl <- lapply(fl, comp)
}
class(fl) <- "mvtb"
return(fl)
}
<bytecode: 0x9646e08>
<environment: namespace:mvtboost>
--- function search by body ---
Function mvtb in namespace mvtboost has this body.
----------- END OF FAILURE REPORT --------------
-- 11. Error: mvtb.uncomp (@test_params.R#58) ---------------------------------
the condition has length > 1
Backtrace:
1. mvtboost::mvtb(X = X, Y = Y, n.trees = 5, seednum = 8, compress = TRUE)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
mvtboost
--- call from context ---
mvtb(X = X, Y = Y, n.trees = 5, seednum = 8, compress = FALSE,
cv.folds = 3, save.cv = T, iter.details = T)
--- call from argument ---
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
--- R stacktrace ---
where 1 at testthat/test_params.R#66: mvtb(X = X, Y = Y, n.trees = 5, seednum = 8, compress = FALSE,
cv.folds = 3, save.cv = T, iter.details = T)
where 2: eval(code, test_env)
where 3: eval(code, test_env)
where 4: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 5: doTryCatch(return(expr), name, parentenv, handler)
where 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 7: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 8: doTryCatch(return(expr), name, parentenv, handler)
where 9: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 10: tryCatchList(expr, classes, parentenv, handlers)
where 11: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 12: test_code(desc, code, env = parent.frame())
where 13 at testthat/test_params.R#65: test_that("iter.details", {
r <- mvtb(X = X, Y = Y, n.trees = 5, seednum = 8, compress = FALSE,
cv.folds = 3, save.cv = T, iter.details = T)
expect_true(all(c("trainerr", "testerr", "cv.err", "ocv") %in%
names(r)))
expect_length(r$testerr, r$best.trees$last)
expect_length(r$trainerr, r$best.trees$last)
expect_length(r$cv.err, r$best.trees$last)
r <- mvtb(X = X, Y = Y, n.trees = 5, seednum = 8, compress = FALSE,
cv.folds = 3, save.cv = F, iter.details = F)
expect_named(r, c("models", "best.trees", "params", "s",
"ocv", "n", "xnames", "ynames"))
expect_null(r$ocv)
r <- mvtb(X = X, Y = Y, n.trees = 5, seednum = 8, compress = FALSE,
cv.folds = 3, save.cv = T, iter.details = F)
})
where 14: eval(code, test_env)
where 15: eval(code, test_env)
where 16: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 17: doTryCatch(return(expr), name, parentenv, handler)
where 18: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 19: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 20: doTryCatch(return(expr), name, parentenv, handler)
where 21: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 22: tryCatchList(expr, classes, parentenv, handlers)
where 23: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 24: test_code(NULL, exprs, env)
where 25: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 26: force(code)
where 27: doWithOneRestart(return(expr), restart)
where 28: withOneRestart(expr, restarts[[1L]])
where 29: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 30: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
{
reporter$start_file(basename(path))
lister$start_file(basename(path))
source_file(path, new.env(parent = env), chdir = TRUE,
wrap = wrap)
reporter$.end_context()
reporter$end_file()
})
where 31: FUN(X[[i]], ...)
where 32: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 33: force(code)
where 34: doWithOneRestart(return(expr), restart)
where 35: withOneRestart(expr, restarts[[1L]])
where 36: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 37: with_reporter(reporter = current_reporter, results <- lapply(paths,
test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
load_helpers = FALSE, wrap = wrap))
where 38: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 39: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
wrap = wrap)
where 40: test_package_dir(package = package, test_path = test_path, filter = filter,
reporter = reporter, ..., stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 41: test_check("mvtboost")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (Y, X, n.trees = 100, shrinkage = 0.01, interaction.depth = 1,
distribution = "gaussian", train.fraction = 1, bag.fraction = 1,
cv.folds = 1, s = NULL, seednum = NULL, compress = FALSE,
save.cv = FALSE, iter.details = TRUE, verbose = FALSE, mc.cores = 1,
...)
{
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
if (is.null(ncol(X))) {
X <- as.matrix(X)
}
params <- c(as.list(environment()), list(...))
if (!is.null(seednum)) {
set.seed(seednum)
}
stopifnot(nrow(X) == nrow(Y))
n <- nrow(X)
k <- ncol(Y)
p <- ncol(X)
if (is.null(colnames(X))) {
colnames(X) <- paste("X", 1:p, sep = "")
}
if (is.null(colnames(Y))) {
colnames(Y) <- paste("Y", 1:k, sep = "")
}
xnames <- colnames(X)
ynames <- colnames(Y)
if (is.null(s)) {
s <- sample(1:n, floor(n * train.fraction), replace = F)
}
if (any(is.na(Y))) {
stop("NAs not allowed in outcome variables.")
}
if (shrinkage > 1 | shrinkage <= 0) {
stop("shrinkage should be > 0, < 1")
}
if (train.fraction > 1 | train.fraction <= 0) {
stop("train.fraction should be > 0, < 1")
}
if (bag.fraction > 1 | bag.fraction <= 0) {
stop("bag.fraction should be > 0, < 1")
}
trainerr <- testerr <- vector(length = n.trees)
if (cv.folds > 1) {
ocv <- mvtbCV(Y = Y, X = X, cv.folds = cv.folds, s = s,
save.cv = save.cv, mc.cores = mc.cores, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, seednum = seednum)
best.iters.cv <- ocv$best.iters.cv
cv.err <- ocv$cv.err
out.fit <- ocv$models.k[[cv.folds + 1]]
}
else {
out.fit <- mvtb.fit(Y = Y, X = X, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, s = s, seednum = seednum, ...)
best.iters.cv <- NULL
cv.err <- NULL
ocv <- NULL
}
models <- out.fit$models
trainerr <- out.fit$trainerr
testerr <- out.fit$testerr
best.trees <- list(best.testerr = which.min(testerr), best.cv = best.iters.cv,
last = n.trees)
if (!save.cv) {
ocv <- NULL
}
if (iter.details == T) {
fl <- list(models = models, best.trees = best.trees,
params = params, trainerr = trainerr, testerr = testerr,
cv.err = cv.err, ocv = ocv, s = s, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
else {
fl <- list(models = models, best.trees = best.trees,
params = params, s = s, ocv = ocv, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
if (compress) {
fl <- lapply(fl, comp)
}
class(fl) <- "mvtb"
return(fl)
}
<bytecode: 0x9646e08>
<environment: namespace:mvtboost>
--- function search by body ---
Function mvtb in namespace mvtboost has this body.
----------- END OF FAILURE REPORT --------------
-- 12. Error: iter.details (@test_params.R#66) --------------------------------
the condition has length > 1
Backtrace:
1. mvtboost::mvtb(...)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
mvtboost
--- call from context ---
mvtb(X = X, Y = Y, n.trees = 5, train.fraction = 0.5, bag.fraction = 0.5,
s = 1:500, seednum = 8, compress = FALSE, cv.folds = 3, save.cv = T,
verbose = F)
--- call from argument ---
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
--- R stacktrace ---
where 1: mvtb(X = X, Y = Y, n.trees = 5, train.fraction = 0.5, bag.fraction = 0.5,
s = 1:500, seednum = 8, compress = FALSE, cv.folds = 3, save.cv = T,
verbose = F)
where 2: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
where 3: withVisible(code)
where 4: withCallingHandlers(withVisible(code), warning = handle_warning,
message = handle_message)
where 5: force(code)
where 6: withr::with_output_sink(temp, withCallingHandlers(withVisible(code),
warning = handle_warning, message = handle_message))
where 7: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)),
...)
where 8: quasi_capture(enquo(object), NULL, evaluate_promise)
where 9 at testthat/test_params.R#79: expect_silent(mvtb(X = X, Y = Y, n.trees = 5, train.fraction = 0.5,
bag.fraction = 0.5, s = 1:500, seednum = 8, compress = FALSE,
cv.folds = 3, save.cv = T, verbose = F))
where 10: eval(code, test_env)
where 11: eval(code, test_env)
where 12: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 13: doTryCatch(return(expr), name, parentenv, handler)
where 14: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 15: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 16: doTryCatch(return(expr), name, parentenv, handler)
where 17: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 18: tryCatchList(expr, classes, parentenv, handlers)
where 19: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 20: test_code(desc, code, env = parent.frame())
where 21 at testthat/test_params.R#78: test_that("verbose", {
expect_silent(mvtb(X = X, Y = Y, n.trees = 5, train.fraction = 0.5,
bag.fraction = 0.5, s = 1:500, seednum = 8, compress = FALSE,
cv.folds = 3, save.cv = T, verbose = F))
expect_output(mvtb(X = X, Y = Y, n.trees = 5, train.fraction = 0.5,
bag.fraction = 0.5, s = 1:500, seednum = 8, compress = FALSE,
cv.folds = 3, save.cv = T, verbose = T))
})
where 22: eval(code, test_env)
where 23: eval(code, test_env)
where 24: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 25: doTryCatch(return(expr), name, parentenv, handler)
where 26: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 27: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 28: doTryCatch(return(expr), name, parentenv, handler)
where 29: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 30: tryCatchList(expr, classes, parentenv, handlers)
where 31: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 32: test_code(NULL, exprs, env)
where 33: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 34: force(code)
where 35: doWithOneRestart(return(expr), restart)
where 36: withOneRestart(expr, restarts[[1L]])
where 37: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 38: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
{
reporter$start_file(basename(path))
lister$start_file(basename(path))
source_file(path, new.env(parent = env), chdir = TRUE,
wrap = wrap)
reporter$.end_context()
reporter$end_file()
})
where 39: FUN(X[[i]], ...)
where 40: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 41: force(code)
where 42: doWithOneRestart(return(expr), restart)
where 43: withOneRestart(expr, restarts[[1L]])
where 44: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 45: with_reporter(reporter = current_reporter, results <- lapply(paths,
test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
load_helpers = FALSE, wrap = wrap))
where 46: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 47: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
wrap = wrap)
where 48: test_package_dir(package = package, test_path = test_path, filter = filter,
reporter = reporter, ..., stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 49: test_check("mvtboost")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (Y, X, n.trees = 100, shrinkage = 0.01, interaction.depth = 1,
distribution = "gaussian", train.fraction = 1, bag.fraction = 1,
cv.folds = 1, s = NULL, seednum = NULL, compress = FALSE,
save.cv = FALSE, iter.details = TRUE, verbose = FALSE, mc.cores = 1,
...)
{
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
if (is.null(ncol(X))) {
X <- as.matrix(X)
}
params <- c(as.list(environment()), list(...))
if (!is.null(seednum)) {
set.seed(seednum)
}
stopifnot(nrow(X) == nrow(Y))
n <- nrow(X)
k <- ncol(Y)
p <- ncol(X)
if (is.null(colnames(X))) {
colnames(X) <- paste("X", 1:p, sep = "")
}
if (is.null(colnames(Y))) {
colnames(Y) <- paste("Y", 1:k, sep = "")
}
xnames <- colnames(X)
ynames <- colnames(Y)
if (is.null(s)) {
s <- sample(1:n, floor(n * train.fraction), replace = F)
}
if (any(is.na(Y))) {
stop("NAs not allowed in outcome variables.")
}
if (shrinkage > 1 | shrinkage <= 0) {
stop("shrinkage should be > 0, < 1")
}
if (train.fraction > 1 | train.fraction <= 0) {
stop("train.fraction should be > 0, < 1")
}
if (bag.fraction > 1 | bag.fraction <= 0) {
stop("bag.fraction should be > 0, < 1")
}
trainerr <- testerr <- vector(length = n.trees)
if (cv.folds > 1) {
ocv <- mvtbCV(Y = Y, X = X, cv.folds = cv.folds, s = s,
save.cv = save.cv, mc.cores = mc.cores, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, seednum = seednum)
best.iters.cv <- ocv$best.iters.cv
cv.err <- ocv$cv.err
out.fit <- ocv$models.k[[cv.folds + 1]]
}
else {
out.fit <- mvtb.fit(Y = Y, X = X, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, s = s, seednum = seednum, ...)
best.iters.cv <- NULL
cv.err <- NULL
ocv <- NULL
}
models <- out.fit$models
trainerr <- out.fit$trainerr
testerr <- out.fit$testerr
best.trees <- list(best.testerr = which.min(testerr), best.cv = best.iters.cv,
last = n.trees)
if (!save.cv) {
ocv <- NULL
}
if (iter.details == T) {
fl <- list(models = models, best.trees = best.trees,
params = params, trainerr = trainerr, testerr = testerr,
cv.err = cv.err, ocv = ocv, s = s, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
else {
fl <- list(models = models, best.trees = best.trees,
params = params, s = s, ocv = ocv, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
if (compress) {
fl <- lapply(fl, comp)
}
class(fl) <- "mvtb"
return(fl)
}
<bytecode: 0x9646e08>
<environment: namespace:mvtboost>
--- function search by body ---
Function mvtb in namespace mvtboost has this body.
----------- END OF FAILURE REPORT --------------
-- 13. Error: verbose (@test_params.R#79) -------------------------------------
the condition has length > 1
Backtrace:
1. testthat::expect_silent(...)
9. mvtboost::mvtb(...)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
mvtboost
--- call from context ---
mvtb(X = X, Y = Y, n.trees = 50, keep.data = FALSE)
--- call from argument ---
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
--- R stacktrace ---
where 1 at testthat/test_params.R#88: mvtb(X = X, Y = Y, n.trees = 50, keep.data = FALSE)
where 2: eval(code, test_env)
where 3: eval(code, test_env)
where 4: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 5: doTryCatch(return(expr), name, parentenv, handler)
where 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 7: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 8: doTryCatch(return(expr), name, parentenv, handler)
where 9: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 10: tryCatchList(expr, classes, parentenv, handlers)
where 11: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 12: test_code(desc, code, env = parent.frame())
where 13 at testthat/test_params.R#87: test_that("keep.data", {
r <- mvtb(X = X, Y = Y, n.trees = 50, keep.data = FALSE)
expect_null(r$models[[1]]$data)
r <- mvtb(X = X, Y = Y, n.trees = 50, keep.data = TRUE)
expect_is(r$models[[1]]$data, "list")
})
where 14: eval(code, test_env)
where 15: eval(code, test_env)
where 16: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 17: doTryCatch(return(expr), name, parentenv, handler)
where 18: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 19: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 20: doTryCatch(return(expr), name, parentenv, handler)
where 21: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 22: tryCatchList(expr, classes, parentenv, handlers)
where 23: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 24: test_code(NULL, exprs, env)
where 25: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 26: force(code)
where 27: doWithOneRestart(return(expr), restart)
where 28: withOneRestart(expr, restarts[[1L]])
where 29: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 30: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
{
reporter$start_file(basename(path))
lister$start_file(basename(path))
source_file(path, new.env(parent = env), chdir = TRUE,
wrap = wrap)
reporter$.end_context()
reporter$end_file()
})
where 31: FUN(X[[i]], ...)
where 32: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 33: force(code)
where 34: doWithOneRestart(return(expr), restart)
where 35: withOneRestart(expr, restarts[[1L]])
where 36: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 37: with_reporter(reporter = current_reporter, results <- lapply(paths,
test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
load_helpers = FALSE, wrap = wrap))
where 38: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 39: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
wrap = wrap)
where 40: test_package_dir(package = package, test_path = test_path, filter = filter,
reporter = reporter, ..., stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 41: test_check("mvtboost")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (Y, X, n.trees = 100, shrinkage = 0.01, interaction.depth = 1,
distribution = "gaussian", train.fraction = 1, bag.fraction = 1,
cv.folds = 1, s = NULL, seednum = NULL, compress = FALSE,
save.cv = FALSE, iter.details = TRUE, verbose = FALSE, mc.cores = 1,
...)
{
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
if (is.null(ncol(X))) {
X <- as.matrix(X)
}
params <- c(as.list(environment()), list(...))
if (!is.null(seednum)) {
set.seed(seednum)
}
stopifnot(nrow(X) == nrow(Y))
n <- nrow(X)
k <- ncol(Y)
p <- ncol(X)
if (is.null(colnames(X))) {
colnames(X) <- paste("X", 1:p, sep = "")
}
if (is.null(colnames(Y))) {
colnames(Y) <- paste("Y", 1:k, sep = "")
}
xnames <- colnames(X)
ynames <- colnames(Y)
if (is.null(s)) {
s <- sample(1:n, floor(n * train.fraction), replace = F)
}
if (any(is.na(Y))) {
stop("NAs not allowed in outcome variables.")
}
if (shrinkage > 1 | shrinkage <= 0) {
stop("shrinkage should be > 0, < 1")
}
if (train.fraction > 1 | train.fraction <= 0) {
stop("train.fraction should be > 0, < 1")
}
if (bag.fraction > 1 | bag.fraction <= 0) {
stop("bag.fraction should be > 0, < 1")
}
trainerr <- testerr <- vector(length = n.trees)
if (cv.folds > 1) {
ocv <- mvtbCV(Y = Y, X = X, cv.folds = cv.folds, s = s,
save.cv = save.cv, mc.cores = mc.cores, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, seednum = seednum)
best.iters.cv <- ocv$best.iters.cv
cv.err <- ocv$cv.err
out.fit <- ocv$models.k[[cv.folds + 1]]
}
else {
out.fit <- mvtb.fit(Y = Y, X = X, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, s = s, seednum = seednum, ...)
best.iters.cv <- NULL
cv.err <- NULL
ocv <- NULL
}
models <- out.fit$models
trainerr <- out.fit$trainerr
testerr <- out.fit$testerr
best.trees <- list(best.testerr = which.min(testerr), best.cv = best.iters.cv,
last = n.trees)
if (!save.cv) {
ocv <- NULL
}
if (iter.details == T) {
fl <- list(models = models, best.trees = best.trees,
params = params, trainerr = trainerr, testerr = testerr,
cv.err = cv.err, ocv = ocv, s = s, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
else {
fl <- list(models = models, best.trees = best.trees,
params = params, s = s, ocv = ocv, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
if (compress) {
fl <- lapply(fl, comp)
}
class(fl) <- "mvtb"
return(fl)
}
<bytecode: 0x9646e08>
<environment: namespace:mvtboost>
--- function search by body ---
Function mvtb in namespace mvtboost has this body.
----------- END OF FAILURE REPORT --------------
-- 14. Error: keep.data (@test_params.R#88) -----------------------------------
the condition has length > 1
Backtrace:
1. mvtboost::mvtb(X = X, Y = Y, n.trees = 50, keep.data = FALSE)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
mvtboost
--- call from context ---
mvtb(X = X, Y = Y, n.trees = 50)
--- call from argument ---
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
--- R stacktrace ---
where 1 at testthat/test_params.R#95: mvtb(X = X, Y = Y, n.trees = 50)
where 2: eval(code, test_env)
where 3: eval(code, test_env)
where 4: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 5: doTryCatch(return(expr), name, parentenv, handler)
where 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 7: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 8: doTryCatch(return(expr), name, parentenv, handler)
where 9: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 10: tryCatchList(expr, classes, parentenv, handlers)
where 11: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 12: test_code(desc, code, env = parent.frame())
where 13 at testthat/test_params.R#94: test_that("distribution", {
r <- mvtb(X = X, Y = Y, n.trees = 50)
expect_equal(r$models[[1]]$distribution$name, "gaussian")
r <- mvtb(X = X, Y = Y, n.trees = 50, distribution = "gaussian")
expect_equal(r$models[[1]]$distribution$name, "gaussian")
expect_error(mvtb(X = X, Y = Y, n.trees = 50, distribution = "bernoulli"))
})
where 14: eval(code, test_env)
where 15: eval(code, test_env)
where 16: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 17: doTryCatch(return(expr), name, parentenv, handler)
where 18: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 19: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 20: doTryCatch(return(expr), name, parentenv, handler)
where 21: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 22: tryCatchList(expr, classes, parentenv, handlers)
where 23: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 24: test_code(NULL, exprs, env)
where 25: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 26: force(code)
where 27: doWithOneRestart(return(expr), restart)
where 28: withOneRestart(expr, restarts[[1L]])
where 29: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 30: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
{
reporter$start_file(basename(path))
lister$start_file(basename(path))
source_file(path, new.env(parent = env), chdir = TRUE,
wrap = wrap)
reporter$.end_context()
reporter$end_file()
})
where 31: FUN(X[[i]], ...)
where 32: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 33: force(code)
where 34: doWithOneRestart(return(expr), restart)
where 35: withOneRestart(expr, restarts[[1L]])
where 36: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 37: with_reporter(reporter = current_reporter, results <- lapply(paths,
test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
load_helpers = FALSE, wrap = wrap))
where 38: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 39: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
wrap = wrap)
where 40: test_package_dir(package = package, test_path = test_path, filter = filter,
reporter = reporter, ..., stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 41: test_check("mvtboost")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (Y, X, n.trees = 100, shrinkage = 0.01, interaction.depth = 1,
distribution = "gaussian", train.fraction = 1, bag.fraction = 1,
cv.folds = 1, s = NULL, seednum = NULL, compress = FALSE,
save.cv = FALSE, iter.details = TRUE, verbose = FALSE, mc.cores = 1,
...)
{
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
if (is.null(ncol(X))) {
X <- as.matrix(X)
}
params <- c(as.list(environment()), list(...))
if (!is.null(seednum)) {
set.seed(seednum)
}
stopifnot(nrow(X) == nrow(Y))
n <- nrow(X)
k <- ncol(Y)
p <- ncol(X)
if (is.null(colnames(X))) {
colnames(X) <- paste("X", 1:p, sep = "")
}
if (is.null(colnames(Y))) {
colnames(Y) <- paste("Y", 1:k, sep = "")
}
xnames <- colnames(X)
ynames <- colnames(Y)
if (is.null(s)) {
s <- sample(1:n, floor(n * train.fraction), replace = F)
}
if (any(is.na(Y))) {
stop("NAs not allowed in outcome variables.")
}
if (shrinkage > 1 | shrinkage <= 0) {
stop("shrinkage should be > 0, < 1")
}
if (train.fraction > 1 | train.fraction <= 0) {
stop("train.fraction should be > 0, < 1")
}
if (bag.fraction > 1 | bag.fraction <= 0) {
stop("bag.fraction should be > 0, < 1")
}
trainerr <- testerr <- vector(length = n.trees)
if (cv.folds > 1) {
ocv <- mvtbCV(Y = Y, X = X, cv.folds = cv.folds, s = s,
save.cv = save.cv, mc.cores = mc.cores, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, seednum = seednum)
best.iters.cv <- ocv$best.iters.cv
cv.err <- ocv$cv.err
out.fit <- ocv$models.k[[cv.folds + 1]]
}
else {
out.fit <- mvtb.fit(Y = Y, X = X, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, s = s, seednum = seednum, ...)
best.iters.cv <- NULL
cv.err <- NULL
ocv <- NULL
}
models <- out.fit$models
trainerr <- out.fit$trainerr
testerr <- out.fit$testerr
best.trees <- list(best.testerr = which.min(testerr), best.cv = best.iters.cv,
last = n.trees)
if (!save.cv) {
ocv <- NULL
}
if (iter.details == T) {
fl <- list(models = models, best.trees = best.trees,
params = params, trainerr = trainerr, testerr = testerr,
cv.err = cv.err, ocv = ocv, s = s, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
else {
fl <- list(models = models, best.trees = best.trees,
params = params, s = s, ocv = ocv, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
if (compress) {
fl <- lapply(fl, comp)
}
class(fl) <- "mvtb"
return(fl)
}
<bytecode: 0x9646e08>
<environment: namespace:mvtboost>
--- function search by body ---
Function mvtb in namespace mvtboost has this body.
----------- END OF FAILURE REPORT --------------
-- 15. Error: distribution (@test_params.R#95) --------------------------------
the condition has length > 1
Backtrace:
1. mvtboost::mvtb(X = X, Y = Y, n.trees = 50)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
mvtboost
--- call from context ---
mvtb(X = X, Y = Y, n.trees = 10, train.fraction = i, s = 1:floor(n *
i), save.cv = TRUE)
--- call from argument ---
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
--- R stacktrace ---
where 1 at testthat/test_params.R#105: mvtb(X = X, Y = Y, n.trees = 10, train.fraction = i, s = 1:floor(n *
i), save.cv = TRUE)
where 2: eval(code, test_env)
where 3: eval(code, test_env)
where 4: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 5: doTryCatch(return(expr), name, parentenv, handler)
where 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 7: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 8: doTryCatch(return(expr), name, parentenv, handler)
where 9: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 10: tryCatchList(expr, classes, parentenv, handlers)
where 11: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 12: test_code(desc, code, env = parent.frame())
where 13 at testthat/test_params.R#102: test_that("train.fraction and s", {
for (i in seq(0.1, 0.9, by = 0.1)) {
r <- mvtb(X = X, Y = Y, n.trees = 10, train.fraction = i,
s = 1:floor(n * i), save.cv = TRUE)
expect_true(all(r$s %in% 1:floor(n * i)))
}
})
where 14: eval(code, test_env)
where 15: eval(code, test_env)
where 16: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 17: doTryCatch(return(expr), name, parentenv, handler)
where 18: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 19: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 20: doTryCatch(return(expr), name, parentenv, handler)
where 21: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 22: tryCatchList(expr, classes, parentenv, handlers)
where 23: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 24: test_code(NULL, exprs, env)
where 25: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 26: force(code)
where 27: doWithOneRestart(return(expr), restart)
where 28: withOneRestart(expr, restarts[[1L]])
where 29: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 30: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
{
reporter$start_file(basename(path))
lister$start_file(basename(path))
source_file(path, new.env(parent = env), chdir = TRUE,
wrap = wrap)
reporter$.end_context()
reporter$end_file()
})
where 31: FUN(X[[i]], ...)
where 32: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 33: force(code)
where 34: doWithOneRestart(return(expr), restart)
where 35: withOneRestart(expr, restarts[[1L]])
where 36: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 37: with_reporter(reporter = current_reporter, results <- lapply(paths,
test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
load_helpers = FALSE, wrap = wrap))
where 38: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 39: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
wrap = wrap)
where 40: test_package_dir(package = package, test_path = test_path, filter = filter,
reporter = reporter, ..., stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 41: test_check("mvtboost")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (Y, X, n.trees = 100, shrinkage = 0.01, interaction.depth = 1,
distribution = "gaussian", train.fraction = 1, bag.fraction = 1,
cv.folds = 1, s = NULL, seednum = NULL, compress = FALSE,
save.cv = FALSE, iter.details = TRUE, verbose = FALSE, mc.cores = 1,
...)
{
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
if (is.null(ncol(X))) {
X <- as.matrix(X)
}
params <- c(as.list(environment()), list(...))
if (!is.null(seednum)) {
set.seed(seednum)
}
stopifnot(nrow(X) == nrow(Y))
n <- nrow(X)
k <- ncol(Y)
p <- ncol(X)
if (is.null(colnames(X))) {
colnames(X) <- paste("X", 1:p, sep = "")
}
if (is.null(colnames(Y))) {
colnames(Y) <- paste("Y", 1:k, sep = "")
}
xnames <- colnames(X)
ynames <- colnames(Y)
if (is.null(s)) {
s <- sample(1:n, floor(n * train.fraction), replace = F)
}
if (any(is.na(Y))) {
stop("NAs not allowed in outcome variables.")
}
if (shrinkage > 1 | shrinkage <= 0) {
stop("shrinkage should be > 0, < 1")
}
if (train.fraction > 1 | train.fraction <= 0) {
stop("train.fraction should be > 0, < 1")
}
if (bag.fraction > 1 | bag.fraction <= 0) {
stop("bag.fraction should be > 0, < 1")
}
trainerr <- testerr <- vector(length = n.trees)
if (cv.folds > 1) {
ocv <- mvtbCV(Y = Y, X = X, cv.folds = cv.folds, s = s,
save.cv = save.cv, mc.cores = mc.cores, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, seednum = seednum)
best.iters.cv <- ocv$best.iters.cv
cv.err <- ocv$cv.err
out.fit <- ocv$models.k[[cv.folds + 1]]
}
else {
out.fit <- mvtb.fit(Y = Y, X = X, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, s = s, seednum = seednum, ...)
best.iters.cv <- NULL
cv.err <- NULL
ocv <- NULL
}
models <- out.fit$models
trainerr <- out.fit$trainerr
testerr <- out.fit$testerr
best.trees <- list(best.testerr = which.min(testerr), best.cv = best.iters.cv,
last = n.trees)
if (!save.cv) {
ocv <- NULL
}
if (iter.details == T) {
fl <- list(models = models, best.trees = best.trees,
params = params, trainerr = trainerr, testerr = testerr,
cv.err = cv.err, ocv = ocv, s = s, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
else {
fl <- list(models = models, best.trees = best.trees,
params = params, s = s, ocv = ocv, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
if (compress) {
fl <- lapply(fl, comp)
}
class(fl) <- "mvtb"
return(fl)
}
<bytecode: 0x9646e08>
<environment: namespace:mvtboost>
--- function search by body ---
Function mvtb in namespace mvtboost has this body.
----------- END OF FAILURE REPORT --------------
-- 16. Error: train.fraction and s (@test_params.R#105) -----------------------
the condition has length > 1
Backtrace:
1. mvtboost::mvtb(...)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
mvtboost
--- call from context ---
mvtb(X = X, Y = Y, n.trees = 50, interaction.depth = 1)
--- call from argument ---
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
--- R stacktrace ---
where 1 at testthat/test_params.R#111: mvtb(X = X, Y = Y, n.trees = 50, interaction.depth = 1)
where 2: eval(code, test_env)
where 3: eval(code, test_env)
where 4: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 5: doTryCatch(return(expr), name, parentenv, handler)
where 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 7: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 8: doTryCatch(return(expr), name, parentenv, handler)
where 9: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 10: tryCatchList(expr, classes, parentenv, handlers)
where 11: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 12: test_code(desc, code, env = parent.frame())
where 13 at testthat/test_params.R#110: test_that("interaction depth", {
r <- mvtb(X = X, Y = Y, n.trees = 50, interaction.depth = 1)
r2 <- mvtb(X = X, Y = Y, n.trees = 50, interaction.depth = 2)
r3 <- mvtb(X = X, Y = Y, n.trees = 50, interaction.depth = 2)
expect_equal(r2$params$interaction.depth, 2)
n <- 1:3
nodes <- 3 * n + 1
expect_true(all(unlist(lapply(r$finaltree[[1]], function(t) {
length(t[[1]])
})) == nodes[1]))
expect_true(all(unlist(lapply(r2$finaltree[[1]], function(t) {
length(t[[1]])
})) == nodes[2]))
expect_true(all(unlist(lapply(r3$finaltree[[1]], function(t) {
length(t[[1]])
})) == nodes[3]))
})
where 14: eval(code, test_env)
where 15: eval(code, test_env)
where 16: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 17: doTryCatch(return(expr), name, parentenv, handler)
where 18: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 19: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 20: doTryCatch(return(expr), name, parentenv, handler)
where 21: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 22: tryCatchList(expr, classes, parentenv, handlers)
where 23: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 24: test_code(NULL, exprs, env)
where 25: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 26: force(code)
where 27: doWithOneRestart(return(expr), restart)
where 28: withOneRestart(expr, restarts[[1L]])
where 29: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 30: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
{
reporter$start_file(basename(path))
lister$start_file(basename(path))
source_file(path, new.env(parent = env), chdir = TRUE,
wrap = wrap)
reporter$.end_context()
reporter$end_file()
})
where 31: FUN(X[[i]], ...)
where 32: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 33: force(code)
where 34: doWithOneRestart(return(expr), restart)
where 35: withOneRestart(expr, restarts[[1L]])
where 36: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 37: with_reporter(reporter = current_reporter, results <- lapply(paths,
test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
load_helpers = FALSE, wrap = wrap))
where 38: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 39: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
wrap = wrap)
where 40: test_package_dir(package = package, test_path = test_path, filter = filter,
reporter = reporter, ..., stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 41: test_check("mvtboost")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (Y, X, n.trees = 100, shrinkage = 0.01, interaction.depth = 1,
distribution = "gaussian", train.fraction = 1, bag.fraction = 1,
cv.folds = 1, s = NULL, seednum = NULL, compress = FALSE,
save.cv = FALSE, iter.details = TRUE, verbose = FALSE, mc.cores = 1,
...)
{
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
if (is.null(ncol(X))) {
X <- as.matrix(X)
}
params <- c(as.list(environment()), list(...))
if (!is.null(seednum)) {
set.seed(seednum)
}
stopifnot(nrow(X) == nrow(Y))
n <- nrow(X)
k <- ncol(Y)
p <- ncol(X)
if (is.null(colnames(X))) {
colnames(X) <- paste("X", 1:p, sep = "")
}
if (is.null(colnames(Y))) {
colnames(Y) <- paste("Y", 1:k, sep = "")
}
xnames <- colnames(X)
ynames <- colnames(Y)
if (is.null(s)) {
s <- sample(1:n, floor(n * train.fraction), replace = F)
}
if (any(is.na(Y))) {
stop("NAs not allowed in outcome variables.")
}
if (shrinkage > 1 | shrinkage <= 0) {
stop("shrinkage should be > 0, < 1")
}
if (train.fraction > 1 | train.fraction <= 0) {
stop("train.fraction should be > 0, < 1")
}
if (bag.fraction > 1 | bag.fraction <= 0) {
stop("bag.fraction should be > 0, < 1")
}
trainerr <- testerr <- vector(length = n.trees)
if (cv.folds > 1) {
ocv <- mvtbCV(Y = Y, X = X, cv.folds = cv.folds, s = s,
save.cv = save.cv, mc.cores = mc.cores, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, seednum = seednum)
best.iters.cv <- ocv$best.iters.cv
cv.err <- ocv$cv.err
out.fit <- ocv$models.k[[cv.folds + 1]]
}
else {
out.fit <- mvtb.fit(Y = Y, X = X, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, s = s, seednum = seednum, ...)
best.iters.cv <- NULL
cv.err <- NULL
ocv <- NULL
}
models <- out.fit$models
trainerr <- out.fit$trainerr
testerr <- out.fit$testerr
best.trees <- list(best.testerr = which.min(testerr), best.cv = best.iters.cv,
last = n.trees)
if (!save.cv) {
ocv <- NULL
}
if (iter.details == T) {
fl <- list(models = models, best.trees = best.trees,
params = params, trainerr = trainerr, testerr = testerr,
cv.err = cv.err, ocv = ocv, s = s, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
else {
fl <- list(models = models, best.trees = best.trees,
params = params, s = s, ocv = ocv, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
if (compress) {
fl <- lapply(fl, comp)
}
class(fl) <- "mvtb"
return(fl)
}
<bytecode: 0x9646e08>
<environment: namespace:mvtboost>
--- function search by body ---
Function mvtb in namespace mvtboost has this body.
----------- END OF FAILURE REPORT --------------
-- 17. Error: interaction depth (@test_params.R#111) --------------------------
the condition has length > 1
Backtrace:
1. mvtboost::mvtb(X = X, Y = Y, n.trees = 50, interaction.depth = 1)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
mvtboost
--- call from context ---
mvtb(X = X, Y = Y, n.trees = 50, shrinkage = 2)
--- call from argument ---
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
--- R stacktrace ---
where 1: mvtb(X = X, Y = Y, n.trees = 50, shrinkage = 2)
where 2: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
where 3: withCallingHandlers({
code
NULL
}, error = function(cnd) {
if (can_entrace(cnd)) {
cnd <- cnd_entrace(cnd)
}
return_from(env, cnd)
})
where 4: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)),
...)
where 5: quasi_capture(enquo(object), label, capture_error, entrace = TRUE)
where 6 at testthat/test_params.R#129: expect_error(mvtb(X = X, Y = Y, n.trees = 50, shrinkage = 2))
where 7: eval(code, test_env)
where 8: eval(code, test_env)
where 9: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 10: doTryCatch(return(expr), name, parentenv, handler)
where 11: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 12: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 13: doTryCatch(return(expr), name, parentenv, handler)
where 14: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 15: tryCatchList(expr, classes, parentenv, handlers)
where 16: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 17: test_code(desc, code, env = parent.frame())
where 18 at testthat/test_params.R#127: test_that("checks", {
expect_error(mvtb(X = X, Y = Y, n.trees = 50, shrinkage = 2))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, shrinkage = 0))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, shrinkage = -1))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, train.fraction = 2))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, train.fraction = 0))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, train.fraction = -1))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = -1))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = 0))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = 2))
Y[1, 1] <- NA
expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = 2))
})
where 19: eval(code, test_env)
where 20: eval(code, test_env)
where 21: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 22: doTryCatch(return(expr), name, parentenv, handler)
where 23: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 24: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 25: doTryCatch(return(expr), name, parentenv, handler)
where 26: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 27: tryCatchList(expr, classes, parentenv, handlers)
where 28: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 29: test_code(NULL, exprs, env)
where 30: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 31: force(code)
where 32: doWithOneRestart(return(expr), restart)
where 33: withOneRestart(expr, restarts[[1L]])
where 34: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 35: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
{
reporter$start_file(basename(path))
lister$start_file(basename(path))
source_file(path, new.env(parent = env), chdir = TRUE,
wrap = wrap)
reporter$.end_context()
reporter$end_file()
})
where 36: FUN(X[[i]], ...)
where 37: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 38: force(code)
where 39: doWithOneRestart(return(expr), restart)
where 40: withOneRestart(expr, restarts[[1L]])
where 41: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 42: with_reporter(reporter = current_reporter, results <- lapply(paths,
test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
load_helpers = FALSE, wrap = wrap))
where 43: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 44: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
wrap = wrap)
where 45: test_package_dir(package = package, test_path = test_path, filter = filter,
reporter = reporter, ..., stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 46: test_check("mvtboost")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (Y, X, n.trees = 100, shrinkage = 0.01, interaction.depth = 1,
distribution = "gaussian", train.fraction = 1, bag.fraction = 1,
cv.folds = 1, s = NULL, seednum = NULL, compress = FALSE,
save.cv = FALSE, iter.details = TRUE, verbose = FALSE, mc.cores = 1,
...)
{
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
if (is.null(ncol(X))) {
X <- as.matrix(X)
}
params <- c(as.list(environment()), list(...))
if (!is.null(seednum)) {
set.seed(seednum)
}
stopifnot(nrow(X) == nrow(Y))
n <- nrow(X)
k <- ncol(Y)
p <- ncol(X)
if (is.null(colnames(X))) {
colnames(X) <- paste("X", 1:p, sep = "")
}
if (is.null(colnames(Y))) {
colnames(Y) <- paste("Y", 1:k, sep = "")
}
xnames <- colnames(X)
ynames <- colnames(Y)
if (is.null(s)) {
s <- sample(1:n, floor(n * train.fraction), replace = F)
}
if (any(is.na(Y))) {
stop("NAs not allowed in outcome variables.")
}
if (shrinkage > 1 | shrinkage <= 0) {
stop("shrinkage should be > 0, < 1")
}
if (train.fraction > 1 | train.fraction <= 0) {
stop("train.fraction should be > 0, < 1")
}
if (bag.fraction > 1 | bag.fraction <= 0) {
stop("bag.fraction should be > 0, < 1")
}
trainerr <- testerr <- vector(length = n.trees)
if (cv.folds > 1) {
ocv <- mvtbCV(Y = Y, X = X, cv.folds = cv.folds, s = s,
save.cv = save.cv, mc.cores = mc.cores, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, seednum = seednum)
best.iters.cv <- ocv$best.iters.cv
cv.err <- ocv$cv.err
out.fit <- ocv$models.k[[cv.folds + 1]]
}
else {
out.fit <- mvtb.fit(Y = Y, X = X, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, s = s, seednum = seednum, ...)
best.iters.cv <- NULL
cv.err <- NULL
ocv <- NULL
}
models <- out.fit$models
trainerr <- out.fit$trainerr
testerr <- out.fit$testerr
best.trees <- list(best.testerr = which.min(testerr), best.cv = best.iters.cv,
last = n.trees)
if (!save.cv) {
ocv <- NULL
}
if (iter.details == T) {
fl <- list(models = models, best.trees = best.trees,
params = params, trainerr = trainerr, testerr = testerr,
cv.err = cv.err, ocv = ocv, s = s, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
else {
fl <- list(models = models, best.trees = best.trees,
params = params, s = s, ocv = ocv, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
if (compress) {
fl <- lapply(fl, comp)
}
class(fl) <- "mvtb"
return(fl)
}
<bytecode: 0x9646e08>
<environment: namespace:mvtboost>
--- function search by body ---
Function mvtb in namespace mvtboost has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
mvtboost
--- call from context ---
mvtb(X = X, Y = Y, n.trees = 50, shrinkage = 0)
--- call from argument ---
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
--- R stacktrace ---
where 1: mvtb(X = X, Y = Y, n.trees = 50, shrinkage = 0)
where 2: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
where 3: withCallingHandlers({
code
NULL
}, error = function(cnd) {
if (can_entrace(cnd)) {
cnd <- cnd_entrace(cnd)
}
return_from(env, cnd)
})
where 4: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)),
...)
where 5: quasi_capture(enquo(object), label, capture_error, entrace = TRUE)
where 6 at testthat/test_params.R#130: expect_error(mvtb(X = X, Y = Y, n.trees = 50, shrinkage = 0))
where 7: eval(code, test_env)
where 8: eval(code, test_env)
where 9: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 10: doTryCatch(return(expr), name, parentenv, handler)
where 11: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 12: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 13: doTryCatch(return(expr), name, parentenv, handler)
where 14: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 15: tryCatchList(expr, classes, parentenv, handlers)
where 16: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 17: test_code(desc, code, env = parent.frame())
where 18 at testthat/test_params.R#127: test_that("checks", {
expect_error(mvtb(X = X, Y = Y, n.trees = 50, shrinkage = 2))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, shrinkage = 0))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, shrinkage = -1))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, train.fraction = 2))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, train.fraction = 0))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, train.fraction = -1))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = -1))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = 0))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = 2))
Y[1, 1] <- NA
expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = 2))
})
where 19: eval(code, test_env)
where 20: eval(code, test_env)
where 21: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 22: doTryCatch(return(expr), name, parentenv, handler)
where 23: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 24: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 25: doTryCatch(return(expr), name, parentenv, handler)
where 26: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 27: tryCatchList(expr, classes, parentenv, handlers)
where 28: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 29: test_code(NULL, exprs, env)
where 30: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 31: force(code)
where 32: doWithOneRestart(return(expr), restart)
where 33: withOneRestart(expr, restarts[[1L]])
where 34: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 35: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
{
reporter$start_file(basename(path))
lister$start_file(basename(path))
source_file(path, new.env(parent = env), chdir = TRUE,
wrap = wrap)
reporter$.end_context()
reporter$end_file()
})
where 36: FUN(X[[i]], ...)
where 37: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 38: force(code)
where 39: doWithOneRestart(return(expr), restart)
where 40: withOneRestart(expr, restarts[[1L]])
where 41: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 42: with_reporter(reporter = current_reporter, results <- lapply(paths,
test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
load_helpers = FALSE, wrap = wrap))
where 43: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 44: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
wrap = wrap)
where 45: test_package_dir(package = package, test_path = test_path, filter = filter,
reporter = reporter, ..., stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 46: test_check("mvtboost")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (Y, X, n.trees = 100, shrinkage = 0.01, interaction.depth = 1,
distribution = "gaussian", train.fraction = 1, bag.fraction = 1,
cv.folds = 1, s = NULL, seednum = NULL, compress = FALSE,
save.cv = FALSE, iter.details = TRUE, verbose = FALSE, mc.cores = 1,
...)
{
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
if (is.null(ncol(X))) {
X <- as.matrix(X)
}
params <- c(as.list(environment()), list(...))
if (!is.null(seednum)) {
set.seed(seednum)
}
stopifnot(nrow(X) == nrow(Y))
n <- nrow(X)
k <- ncol(Y)
p <- ncol(X)
if (is.null(colnames(X))) {
colnames(X) <- paste("X", 1:p, sep = "")
}
if (is.null(colnames(Y))) {
colnames(Y) <- paste("Y", 1:k, sep = "")
}
xnames <- colnames(X)
ynames <- colnames(Y)
if (is.null(s)) {
s <- sample(1:n, floor(n * train.fraction), replace = F)
}
if (any(is.na(Y))) {
stop("NAs not allowed in outcome variables.")
}
if (shrinkage > 1 | shrinkage <= 0) {
stop("shrinkage should be > 0, < 1")
}
if (train.fraction > 1 | train.fraction <= 0) {
stop("train.fraction should be > 0, < 1")
}
if (bag.fraction > 1 | bag.fraction <= 0) {
stop("bag.fraction should be > 0, < 1")
}
trainerr <- testerr <- vector(length = n.trees)
if (cv.folds > 1) {
ocv <- mvtbCV(Y = Y, X = X, cv.folds = cv.folds, s = s,
save.cv = save.cv, mc.cores = mc.cores, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, seednum = seednum)
best.iters.cv <- ocv$best.iters.cv
cv.err <- ocv$cv.err
out.fit <- ocv$models.k[[cv.folds + 1]]
}
else {
out.fit <- mvtb.fit(Y = Y, X = X, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, s = s, seednum = seednum, ...)
best.iters.cv <- NULL
cv.err <- NULL
ocv <- NULL
}
models <- out.fit$models
trainerr <- out.fit$trainerr
testerr <- out.fit$testerr
best.trees <- list(best.testerr = which.min(testerr), best.cv = best.iters.cv,
last = n.trees)
if (!save.cv) {
ocv <- NULL
}
if (iter.details == T) {
fl <- list(models = models, best.trees = best.trees,
params = params, trainerr = trainerr, testerr = testerr,
cv.err = cv.err, ocv = ocv, s = s, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
else {
fl <- list(models = models, best.trees = best.trees,
params = params, s = s, ocv = ocv, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
if (compress) {
fl <- lapply(fl, comp)
}
class(fl) <- "mvtb"
return(fl)
}
<bytecode: 0x9646e08>
<environment: namespace:mvtboost>
--- function search by body ---
Function mvtb in namespace mvtboost has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
mvtboost
--- call from context ---
mvtb(X = X, Y = Y, n.trees = 50, shrinkage = -1)
--- call from argument ---
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
--- R stacktrace ---
where 1: mvtb(X = X, Y = Y, n.trees = 50, shrinkage = -1)
where 2: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
where 3: withCallingHandlers({
code
NULL
}, error = function(cnd) {
if (can_entrace(cnd)) {
cnd <- cnd_entrace(cnd)
}
return_from(env, cnd)
})
where 4: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)),
...)
where 5: quasi_capture(enquo(object), label, capture_error, entrace = TRUE)
where 6 at testthat/test_params.R#131: expect_error(mvtb(X = X, Y = Y, n.trees = 50, shrinkage = -1))
where 7: eval(code, test_env)
where 8: eval(code, test_env)
where 9: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 10: doTryCatch(return(expr), name, parentenv, handler)
where 11: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 12: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 13: doTryCatch(return(expr), name, parentenv, handler)
where 14: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 15: tryCatchList(expr, classes, parentenv, handlers)
where 16: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 17: test_code(desc, code, env = parent.frame())
where 18 at testthat/test_params.R#127: test_that("checks", {
expect_error(mvtb(X = X, Y = Y, n.trees = 50, shrinkage = 2))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, shrinkage = 0))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, shrinkage = -1))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, train.fraction = 2))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, train.fraction = 0))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, train.fraction = -1))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = -1))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = 0))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = 2))
Y[1, 1] <- NA
expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = 2))
})
where 19: eval(code, test_env)
where 20: eval(code, test_env)
where 21: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 22: doTryCatch(return(expr), name, parentenv, handler)
where 23: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 24: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 25: doTryCatch(return(expr), name, parentenv, handler)
where 26: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 27: tryCatchList(expr, classes, parentenv, handlers)
where 28: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 29: test_code(NULL, exprs, env)
where 30: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 31: force(code)
where 32: doWithOneRestart(return(expr), restart)
where 33: withOneRestart(expr, restarts[[1L]])
where 34: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 35: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
{
reporter$start_file(basename(path))
lister$start_file(basename(path))
source_file(path, new.env(parent = env), chdir = TRUE,
wrap = wrap)
reporter$.end_context()
reporter$end_file()
})
where 36: FUN(X[[i]], ...)
where 37: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 38: force(code)
where 39: doWithOneRestart(return(expr), restart)
where 40: withOneRestart(expr, restarts[[1L]])
where 41: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 42: with_reporter(reporter = current_reporter, results <- lapply(paths,
test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
load_helpers = FALSE, wrap = wrap))
where 43: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 44: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
wrap = wrap)
where 45: test_package_dir(package = package, test_path = test_path, filter = filter,
reporter = reporter, ..., stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 46: test_check("mvtboost")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (Y, X, n.trees = 100, shrinkage = 0.01, interaction.depth = 1,
distribution = "gaussian", train.fraction = 1, bag.fraction = 1,
cv.folds = 1, s = NULL, seednum = NULL, compress = FALSE,
save.cv = FALSE, iter.details = TRUE, verbose = FALSE, mc.cores = 1,
...)
{
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
if (is.null(ncol(X))) {
X <- as.matrix(X)
}
params <- c(as.list(environment()), list(...))
if (!is.null(seednum)) {
set.seed(seednum)
}
stopifnot(nrow(X) == nrow(Y))
n <- nrow(X)
k <- ncol(Y)
p <- ncol(X)
if (is.null(colnames(X))) {
colnames(X) <- paste("X", 1:p, sep = "")
}
if (is.null(colnames(Y))) {
colnames(Y) <- paste("Y", 1:k, sep = "")
}
xnames <- colnames(X)
ynames <- colnames(Y)
if (is.null(s)) {
s <- sample(1:n, floor(n * train.fraction), replace = F)
}
if (any(is.na(Y))) {
stop("NAs not allowed in outcome variables.")
}
if (shrinkage > 1 | shrinkage <= 0) {
stop("shrinkage should be > 0, < 1")
}
if (train.fraction > 1 | train.fraction <= 0) {
stop("train.fraction should be > 0, < 1")
}
if (bag.fraction > 1 | bag.fraction <= 0) {
stop("bag.fraction should be > 0, < 1")
}
trainerr <- testerr <- vector(length = n.trees)
if (cv.folds > 1) {
ocv <- mvtbCV(Y = Y, X = X, cv.folds = cv.folds, s = s,
save.cv = save.cv, mc.cores = mc.cores, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, seednum = seednum)
best.iters.cv <- ocv$best.iters.cv
cv.err <- ocv$cv.err
out.fit <- ocv$models.k[[cv.folds + 1]]
}
else {
out.fit <- mvtb.fit(Y = Y, X = X, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, s = s, seednum = seednum, ...)
best.iters.cv <- NULL
cv.err <- NULL
ocv <- NULL
}
models <- out.fit$models
trainerr <- out.fit$trainerr
testerr <- out.fit$testerr
best.trees <- list(best.testerr = which.min(testerr), best.cv = best.iters.cv,
last = n.trees)
if (!save.cv) {
ocv <- NULL
}
if (iter.details == T) {
fl <- list(models = models, best.trees = best.trees,
params = params, trainerr = trainerr, testerr = testerr,
cv.err = cv.err, ocv = ocv, s = s, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
else {
fl <- list(models = models, best.trees = best.trees,
params = params, s = s, ocv = ocv, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
if (compress) {
fl <- lapply(fl, comp)
}
class(fl) <- "mvtb"
return(fl)
}
<bytecode: 0x9646e08>
<environment: namespace:mvtboost>
--- function search by body ---
Function mvtb in namespace mvtboost has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
mvtboost
--- call from context ---
mvtb(X = X, Y = Y, n.trees = 50, train.fraction = 2)
--- call from argument ---
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
--- R stacktrace ---
where 1: mvtb(X = X, Y = Y, n.trees = 50, train.fraction = 2)
where 2: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
where 3: withCallingHandlers({
code
NULL
}, error = function(cnd) {
if (can_entrace(cnd)) {
cnd <- cnd_entrace(cnd)
}
return_from(env, cnd)
})
where 4: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)),
...)
where 5: quasi_capture(enquo(object), label, capture_error, entrace = TRUE)
where 6 at testthat/test_params.R#132: expect_error(mvtb(X = X, Y = Y, n.trees = 50, train.fraction = 2))
where 7: eval(code, test_env)
where 8: eval(code, test_env)
where 9: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 10: doTryCatch(return(expr), name, parentenv, handler)
where 11: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 12: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 13: doTryCatch(return(expr), name, parentenv, handler)
where 14: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 15: tryCatchList(expr, classes, parentenv, handlers)
where 16: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 17: test_code(desc, code, env = parent.frame())
where 18 at testthat/test_params.R#127: test_that("checks", {
expect_error(mvtb(X = X, Y = Y, n.trees = 50, shrinkage = 2))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, shrinkage = 0))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, shrinkage = -1))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, train.fraction = 2))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, train.fraction = 0))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, train.fraction = -1))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = -1))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = 0))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = 2))
Y[1, 1] <- NA
expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = 2))
})
where 19: eval(code, test_env)
where 20: eval(code, test_env)
where 21: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 22: doTryCatch(return(expr), name, parentenv, handler)
where 23: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 24: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 25: doTryCatch(return(expr), name, parentenv, handler)
where 26: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 27: tryCatchList(expr, classes, parentenv, handlers)
where 28: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 29: test_code(NULL, exprs, env)
where 30: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 31: force(code)
where 32: doWithOneRestart(return(expr), restart)
where 33: withOneRestart(expr, restarts[[1L]])
where 34: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 35: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
{
reporter$start_file(basename(path))
lister$start_file(basename(path))
source_file(path, new.env(parent = env), chdir = TRUE,
wrap = wrap)
reporter$.end_context()
reporter$end_file()
})
where 36: FUN(X[[i]], ...)
where 37: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 38: force(code)
where 39: doWithOneRestart(return(expr), restart)
where 40: withOneRestart(expr, restarts[[1L]])
where 41: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 42: with_reporter(reporter = current_reporter, results <- lapply(paths,
test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
load_helpers = FALSE, wrap = wrap))
where 43: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 44: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
wrap = wrap)
where 45: test_package_dir(package = package, test_path = test_path, filter = filter,
reporter = reporter, ..., stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 46: test_check("mvtboost")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (Y, X, n.trees = 100, shrinkage = 0.01, interaction.depth = 1,
distribution = "gaussian", train.fraction = 1, bag.fraction = 1,
cv.folds = 1, s = NULL, seednum = NULL, compress = FALSE,
save.cv = FALSE, iter.details = TRUE, verbose = FALSE, mc.cores = 1,
...)
{
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
if (is.null(ncol(X))) {
X <- as.matrix(X)
}
params <- c(as.list(environment()), list(...))
if (!is.null(seednum)) {
set.seed(seednum)
}
stopifnot(nrow(X) == nrow(Y))
n <- nrow(X)
k <- ncol(Y)
p <- ncol(X)
if (is.null(colnames(X))) {
colnames(X) <- paste("X", 1:p, sep = "")
}
if (is.null(colnames(Y))) {
colnames(Y) <- paste("Y", 1:k, sep = "")
}
xnames <- colnames(X)
ynames <- colnames(Y)
if (is.null(s)) {
s <- sample(1:n, floor(n * train.fraction), replace = F)
}
if (any(is.na(Y))) {
stop("NAs not allowed in outcome variables.")
}
if (shrinkage > 1 | shrinkage <= 0) {
stop("shrinkage should be > 0, < 1")
}
if (train.fraction > 1 | train.fraction <= 0) {
stop("train.fraction should be > 0, < 1")
}
if (bag.fraction > 1 | bag.fraction <= 0) {
stop("bag.fraction should be > 0, < 1")
}
trainerr <- testerr <- vector(length = n.trees)
if (cv.folds > 1) {
ocv <- mvtbCV(Y = Y, X = X, cv.folds = cv.folds, s = s,
save.cv = save.cv, mc.cores = mc.cores, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, seednum = seednum)
best.iters.cv <- ocv$best.iters.cv
cv.err <- ocv$cv.err
out.fit <- ocv$models.k[[cv.folds + 1]]
}
else {
out.fit <- mvtb.fit(Y = Y, X = X, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, s = s, seednum = seednum, ...)
best.iters.cv <- NULL
cv.err <- NULL
ocv <- NULL
}
models <- out.fit$models
trainerr <- out.fit$trainerr
testerr <- out.fit$testerr
best.trees <- list(best.testerr = which.min(testerr), best.cv = best.iters.cv,
last = n.trees)
if (!save.cv) {
ocv <- NULL
}
if (iter.details == T) {
fl <- list(models = models, best.trees = best.trees,
params = params, trainerr = trainerr, testerr = testerr,
cv.err = cv.err, ocv = ocv, s = s, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
else {
fl <- list(models = models, best.trees = best.trees,
params = params, s = s, ocv = ocv, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
if (compress) {
fl <- lapply(fl, comp)
}
class(fl) <- "mvtb"
return(fl)
}
<bytecode: 0x9646e08>
<environment: namespace:mvtboost>
--- function search by body ---
Function mvtb in namespace mvtboost has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
mvtboost
--- call from context ---
mvtb(X = X, Y = Y, n.trees = 50, train.fraction = 0)
--- call from argument ---
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
--- R stacktrace ---
where 1: mvtb(X = X, Y = Y, n.trees = 50, train.fraction = 0)
where 2: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
where 3: withCallingHandlers({
code
NULL
}, error = function(cnd) {
if (can_entrace(cnd)) {
cnd <- cnd_entrace(cnd)
}
return_from(env, cnd)
})
where 4: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)),
...)
where 5: quasi_capture(enquo(object), label, capture_error, entrace = TRUE)
where 6 at testthat/test_params.R#133: expect_error(mvtb(X = X, Y = Y, n.trees = 50, train.fraction = 0))
where 7: eval(code, test_env)
where 8: eval(code, test_env)
where 9: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 10: doTryCatch(return(expr), name, parentenv, handler)
where 11: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 12: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 13: doTryCatch(return(expr), name, parentenv, handler)
where 14: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 15: tryCatchList(expr, classes, parentenv, handlers)
where 16: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 17: test_code(desc, code, env = parent.frame())
where 18 at testthat/test_params.R#127: test_that("checks", {
expect_error(mvtb(X = X, Y = Y, n.trees = 50, shrinkage = 2))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, shrinkage = 0))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, shrinkage = -1))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, train.fraction = 2))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, train.fraction = 0))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, train.fraction = -1))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = -1))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = 0))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = 2))
Y[1, 1] <- NA
expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = 2))
})
where 19: eval(code, test_env)
where 20: eval(code, test_env)
where 21: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 22: doTryCatch(return(expr), name, parentenv, handler)
where 23: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 24: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 25: doTryCatch(return(expr), name, parentenv, handler)
where 26: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 27: tryCatchList(expr, classes, parentenv, handlers)
where 28: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 29: test_code(NULL, exprs, env)
where 30: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 31: force(code)
where 32: doWithOneRestart(return(expr), restart)
where 33: withOneRestart(expr, restarts[[1L]])
where 34: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 35: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
{
reporter$start_file(basename(path))
lister$start_file(basename(path))
source_file(path, new.env(parent = env), chdir = TRUE,
wrap = wrap)
reporter$.end_context()
reporter$end_file()
})
where 36: FUN(X[[i]], ...)
where 37: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 38: force(code)
where 39: doWithOneRestart(return(expr), restart)
where 40: withOneRestart(expr, restarts[[1L]])
where 41: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 42: with_reporter(reporter = current_reporter, results <- lapply(paths,
test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
load_helpers = FALSE, wrap = wrap))
where 43: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 44: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
wrap = wrap)
where 45: test_package_dir(package = package, test_path = test_path, filter = filter,
reporter = reporter, ..., stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 46: test_check("mvtboost")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (Y, X, n.trees = 100, shrinkage = 0.01, interaction.depth = 1,
distribution = "gaussian", train.fraction = 1, bag.fraction = 1,
cv.folds = 1, s = NULL, seednum = NULL, compress = FALSE,
save.cv = FALSE, iter.details = TRUE, verbose = FALSE, mc.cores = 1,
...)
{
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
if (is.null(ncol(X))) {
X <- as.matrix(X)
}
params <- c(as.list(environment()), list(...))
if (!is.null(seednum)) {
set.seed(seednum)
}
stopifnot(nrow(X) == nrow(Y))
n <- nrow(X)
k <- ncol(Y)
p <- ncol(X)
if (is.null(colnames(X))) {
colnames(X) <- paste("X", 1:p, sep = "")
}
if (is.null(colnames(Y))) {
colnames(Y) <- paste("Y", 1:k, sep = "")
}
xnames <- colnames(X)
ynames <- colnames(Y)
if (is.null(s)) {
s <- sample(1:n, floor(n * train.fraction), replace = F)
}
if (any(is.na(Y))) {
stop("NAs not allowed in outcome variables.")
}
if (shrinkage > 1 | shrinkage <= 0) {
stop("shrinkage should be > 0, < 1")
}
if (train.fraction > 1 | train.fraction <= 0) {
stop("train.fraction should be > 0, < 1")
}
if (bag.fraction > 1 | bag.fraction <= 0) {
stop("bag.fraction should be > 0, < 1")
}
trainerr <- testerr <- vector(length = n.trees)
if (cv.folds > 1) {
ocv <- mvtbCV(Y = Y, X = X, cv.folds = cv.folds, s = s,
save.cv = save.cv, mc.cores = mc.cores, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, seednum = seednum)
best.iters.cv <- ocv$best.iters.cv
cv.err <- ocv$cv.err
out.fit <- ocv$models.k[[cv.folds + 1]]
}
else {
out.fit <- mvtb.fit(Y = Y, X = X, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, s = s, seednum = seednum, ...)
best.iters.cv <- NULL
cv.err <- NULL
ocv <- NULL
}
models <- out.fit$models
trainerr <- out.fit$trainerr
testerr <- out.fit$testerr
best.trees <- list(best.testerr = which.min(testerr), best.cv = best.iters.cv,
last = n.trees)
if (!save.cv) {
ocv <- NULL
}
if (iter.details == T) {
fl <- list(models = models, best.trees = best.trees,
params = params, trainerr = trainerr, testerr = testerr,
cv.err = cv.err, ocv = ocv, s = s, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
else {
fl <- list(models = models, best.trees = best.trees,
params = params, s = s, ocv = ocv, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
if (compress) {
fl <- lapply(fl, comp)
}
class(fl) <- "mvtb"
return(fl)
}
<bytecode: 0x9646e08>
<environment: namespace:mvtboost>
--- function search by body ---
Function mvtb in namespace mvtboost has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
mvtboost
--- call from context ---
mvtb(X = X, Y = Y, n.trees = 50, train.fraction = -1)
--- call from argument ---
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
--- R stacktrace ---
where 1: mvtb(X = X, Y = Y, n.trees = 50, train.fraction = -1)
where 2: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
where 3: withCallingHandlers({
code
NULL
}, error = function(cnd) {
if (can_entrace(cnd)) {
cnd <- cnd_entrace(cnd)
}
return_from(env, cnd)
})
where 4: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)),
...)
where 5: quasi_capture(enquo(object), label, capture_error, entrace = TRUE)
where 6 at testthat/test_params.R#134: expect_error(mvtb(X = X, Y = Y, n.trees = 50, train.fraction = -1))
where 7: eval(code, test_env)
where 8: eval(code, test_env)
where 9: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 10: doTryCatch(return(expr), name, parentenv, handler)
where 11: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 12: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 13: doTryCatch(return(expr), name, parentenv, handler)
where 14: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 15: tryCatchList(expr, classes, parentenv, handlers)
where 16: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 17: test_code(desc, code, env = parent.frame())
where 18 at testthat/test_params.R#127: test_that("checks", {
expect_error(mvtb(X = X, Y = Y, n.trees = 50, shrinkage = 2))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, shrinkage = 0))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, shrinkage = -1))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, train.fraction = 2))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, train.fraction = 0))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, train.fraction = -1))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = -1))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = 0))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = 2))
Y[1, 1] <- NA
expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = 2))
})
where 19: eval(code, test_env)
where 20: eval(code, test_env)
where 21: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 22: doTryCatch(return(expr), name, parentenv, handler)
where 23: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 24: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 25: doTryCatch(return(expr), name, parentenv, handler)
where 26: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 27: tryCatchList(expr, classes, parentenv, handlers)
where 28: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 29: test_code(NULL, exprs, env)
where 30: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 31: force(code)
where 32: doWithOneRestart(return(expr), restart)
where 33: withOneRestart(expr, restarts[[1L]])
where 34: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 35: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
{
reporter$start_file(basename(path))
lister$start_file(basename(path))
source_file(path, new.env(parent = env), chdir = TRUE,
wrap = wrap)
reporter$.end_context()
reporter$end_file()
})
where 36: FUN(X[[i]], ...)
where 37: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 38: force(code)
where 39: doWithOneRestart(return(expr), restart)
where 40: withOneRestart(expr, restarts[[1L]])
where 41: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 42: with_reporter(reporter = current_reporter, results <- lapply(paths,
test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
load_helpers = FALSE, wrap = wrap))
where 43: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 44: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
wrap = wrap)
where 45: test_package_dir(package = package, test_path = test_path, filter = filter,
reporter = reporter, ..., stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 46: test_check("mvtboost")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (Y, X, n.trees = 100, shrinkage = 0.01, interaction.depth = 1,
distribution = "gaussian", train.fraction = 1, bag.fraction = 1,
cv.folds = 1, s = NULL, seednum = NULL, compress = FALSE,
save.cv = FALSE, iter.details = TRUE, verbose = FALSE, mc.cores = 1,
...)
{
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
if (is.null(ncol(X))) {
X <- as.matrix(X)
}
params <- c(as.list(environment()), list(...))
if (!is.null(seednum)) {
set.seed(seednum)
}
stopifnot(nrow(X) == nrow(Y))
n <- nrow(X)
k <- ncol(Y)
p <- ncol(X)
if (is.null(colnames(X))) {
colnames(X) <- paste("X", 1:p, sep = "")
}
if (is.null(colnames(Y))) {
colnames(Y) <- paste("Y", 1:k, sep = "")
}
xnames <- colnames(X)
ynames <- colnames(Y)
if (is.null(s)) {
s <- sample(1:n, floor(n * train.fraction), replace = F)
}
if (any(is.na(Y))) {
stop("NAs not allowed in outcome variables.")
}
if (shrinkage > 1 | shrinkage <= 0) {
stop("shrinkage should be > 0, < 1")
}
if (train.fraction > 1 | train.fraction <= 0) {
stop("train.fraction should be > 0, < 1")
}
if (bag.fraction > 1 | bag.fraction <= 0) {
stop("bag.fraction should be > 0, < 1")
}
trainerr <- testerr <- vector(length = n.trees)
if (cv.folds > 1) {
ocv <- mvtbCV(Y = Y, X = X, cv.folds = cv.folds, s = s,
save.cv = save.cv, mc.cores = mc.cores, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, seednum = seednum)
best.iters.cv <- ocv$best.iters.cv
cv.err <- ocv$cv.err
out.fit <- ocv$models.k[[cv.folds + 1]]
}
else {
out.fit <- mvtb.fit(Y = Y, X = X, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, s = s, seednum = seednum, ...)
best.iters.cv <- NULL
cv.err <- NULL
ocv <- NULL
}
models <- out.fit$models
trainerr <- out.fit$trainerr
testerr <- out.fit$testerr
best.trees <- list(best.testerr = which.min(testerr), best.cv = best.iters.cv,
last = n.trees)
if (!save.cv) {
ocv <- NULL
}
if (iter.details == T) {
fl <- list(models = models, best.trees = best.trees,
params = params, trainerr = trainerr, testerr = testerr,
cv.err = cv.err, ocv = ocv, s = s, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
else {
fl <- list(models = models, best.trees = best.trees,
params = params, s = s, ocv = ocv, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
if (compress) {
fl <- lapply(fl, comp)
}
class(fl) <- "mvtb"
return(fl)
}
<bytecode: 0x9646e08>
<environment: namespace:mvtboost>
--- function search by body ---
Function mvtb in namespace mvtboost has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
mvtboost
--- call from context ---
mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = -1)
--- call from argument ---
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
--- R stacktrace ---
where 1: mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = -1)
where 2: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
where 3: withCallingHandlers({
code
NULL
}, error = function(cnd) {
if (can_entrace(cnd)) {
cnd <- cnd_entrace(cnd)
}
return_from(env, cnd)
})
where 4: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)),
...)
where 5: quasi_capture(enquo(object), label, capture_error, entrace = TRUE)
where 6 at testthat/test_params.R#135: expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = -1))
where 7: eval(code, test_env)
where 8: eval(code, test_env)
where 9: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 10: doTryCatch(return(expr), name, parentenv, handler)
where 11: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 12: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 13: doTryCatch(return(expr), name, parentenv, handler)
where 14: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 15: tryCatchList(expr, classes, parentenv, handlers)
where 16: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 17: test_code(desc, code, env = parent.frame())
where 18 at testthat/test_params.R#127: test_that("checks", {
expect_error(mvtb(X = X, Y = Y, n.trees = 50, shrinkage = 2))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, shrinkage = 0))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, shrinkage = -1))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, train.fraction = 2))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, train.fraction = 0))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, train.fraction = -1))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = -1))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = 0))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = 2))
Y[1, 1] <- NA
expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = 2))
})
where 19: eval(code, test_env)
where 20: eval(code, test_env)
where 21: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 22: doTryCatch(return(expr), name, parentenv, handler)
where 23: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 24: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 25: doTryCatch(return(expr), name, parentenv, handler)
where 26: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 27: tryCatchList(expr, classes, parentenv, handlers)
where 28: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 29: test_code(NULL, exprs, env)
where 30: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 31: force(code)
where 32: doWithOneRestart(return(expr), restart)
where 33: withOneRestart(expr, restarts[[1L]])
where 34: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 35: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
{
reporter$start_file(basename(path))
lister$start_file(basename(path))
source_file(path, new.env(parent = env), chdir = TRUE,
wrap = wrap)
reporter$.end_context()
reporter$end_file()
})
where 36: FUN(X[[i]], ...)
where 37: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 38: force(code)
where 39: doWithOneRestart(return(expr), restart)
where 40: withOneRestart(expr, restarts[[1L]])
where 41: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 42: with_reporter(reporter = current_reporter, results <- lapply(paths,
test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
load_helpers = FALSE, wrap = wrap))
where 43: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 44: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
wrap = wrap)
where 45: test_package_dir(package = package, test_path = test_path, filter = filter,
reporter = reporter, ..., stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 46: test_check("mvtboost")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (Y, X, n.trees = 100, shrinkage = 0.01, interaction.depth = 1,
distribution = "gaussian", train.fraction = 1, bag.fraction = 1,
cv.folds = 1, s = NULL, seednum = NULL, compress = FALSE,
save.cv = FALSE, iter.details = TRUE, verbose = FALSE, mc.cores = 1,
...)
{
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
if (is.null(ncol(X))) {
X <- as.matrix(X)
}
params <- c(as.list(environment()), list(...))
if (!is.null(seednum)) {
set.seed(seednum)
}
stopifnot(nrow(X) == nrow(Y))
n <- nrow(X)
k <- ncol(Y)
p <- ncol(X)
if (is.null(colnames(X))) {
colnames(X) <- paste("X", 1:p, sep = "")
}
if (is.null(colnames(Y))) {
colnames(Y) <- paste("Y", 1:k, sep = "")
}
xnames <- colnames(X)
ynames <- colnames(Y)
if (is.null(s)) {
s <- sample(1:n, floor(n * train.fraction), replace = F)
}
if (any(is.na(Y))) {
stop("NAs not allowed in outcome variables.")
}
if (shrinkage > 1 | shrinkage <= 0) {
stop("shrinkage should be > 0, < 1")
}
if (train.fraction > 1 | train.fraction <= 0) {
stop("train.fraction should be > 0, < 1")
}
if (bag.fraction > 1 | bag.fraction <= 0) {
stop("bag.fraction should be > 0, < 1")
}
trainerr <- testerr <- vector(length = n.trees)
if (cv.folds > 1) {
ocv <- mvtbCV(Y = Y, X = X, cv.folds = cv.folds, s = s,
save.cv = save.cv, mc.cores = mc.cores, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, seednum = seednum)
best.iters.cv <- ocv$best.iters.cv
cv.err <- ocv$cv.err
out.fit <- ocv$models.k[[cv.folds + 1]]
}
else {
out.fit <- mvtb.fit(Y = Y, X = X, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, s = s, seednum = seednum, ...)
best.iters.cv <- NULL
cv.err <- NULL
ocv <- NULL
}
models <- out.fit$models
trainerr <- out.fit$trainerr
testerr <- out.fit$testerr
best.trees <- list(best.testerr = which.min(testerr), best.cv = best.iters.cv,
last = n.trees)
if (!save.cv) {
ocv <- NULL
}
if (iter.details == T) {
fl <- list(models = models, best.trees = best.trees,
params = params, trainerr = trainerr, testerr = testerr,
cv.err = cv.err, ocv = ocv, s = s, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
else {
fl <- list(models = models, best.trees = best.trees,
params = params, s = s, ocv = ocv, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
if (compress) {
fl <- lapply(fl, comp)
}
class(fl) <- "mvtb"
return(fl)
}
<bytecode: 0x9646e08>
<environment: namespace:mvtboost>
--- function search by body ---
Function mvtb in namespace mvtboost has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
mvtboost
--- call from context ---
mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = 0)
--- call from argument ---
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
--- R stacktrace ---
where 1: mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = 0)
where 2: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
where 3: withCallingHandlers({
code
NULL
}, error = function(cnd) {
if (can_entrace(cnd)) {
cnd <- cnd_entrace(cnd)
}
return_from(env, cnd)
})
where 4: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)),
...)
where 5: quasi_capture(enquo(object), label, capture_error, entrace = TRUE)
where 6 at testthat/test_params.R#136: expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = 0))
where 7: eval(code, test_env)
where 8: eval(code, test_env)
where 9: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 10: doTryCatch(return(expr), name, parentenv, handler)
where 11: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 12: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 13: doTryCatch(return(expr), name, parentenv, handler)
where 14: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 15: tryCatchList(expr, classes, parentenv, handlers)
where 16: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 17: test_code(desc, code, env = parent.frame())
where 18 at testthat/test_params.R#127: test_that("checks", {
expect_error(mvtb(X = X, Y = Y, n.trees = 50, shrinkage = 2))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, shrinkage = 0))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, shrinkage = -1))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, train.fraction = 2))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, train.fraction = 0))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, train.fraction = -1))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = -1))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = 0))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = 2))
Y[1, 1] <- NA
expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = 2))
})
where 19: eval(code, test_env)
where 20: eval(code, test_env)
where 21: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 22: doTryCatch(return(expr), name, parentenv, handler)
where 23: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 24: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 25: doTryCatch(return(expr), name, parentenv, handler)
where 26: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 27: tryCatchList(expr, classes, parentenv, handlers)
where 28: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 29: test_code(NULL, exprs, env)
where 30: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 31: force(code)
where 32: doWithOneRestart(return(expr), restart)
where 33: withOneRestart(expr, restarts[[1L]])
where 34: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 35: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
{
reporter$start_file(basename(path))
lister$start_file(basename(path))
source_file(path, new.env(parent = env), chdir = TRUE,
wrap = wrap)
reporter$.end_context()
reporter$end_file()
})
where 36: FUN(X[[i]], ...)
where 37: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 38: force(code)
where 39: doWithOneRestart(return(expr), restart)
where 40: withOneRestart(expr, restarts[[1L]])
where 41: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 42: with_reporter(reporter = current_reporter, results <- lapply(paths,
test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
load_helpers = FALSE, wrap = wrap))
where 43: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 44: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
wrap = wrap)
where 45: test_package_dir(package = package, test_path = test_path, filter = filter,
reporter = reporter, ..., stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 46: test_check("mvtboost")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (Y, X, n.trees = 100, shrinkage = 0.01, interaction.depth = 1,
distribution = "gaussian", train.fraction = 1, bag.fraction = 1,
cv.folds = 1, s = NULL, seednum = NULL, compress = FALSE,
save.cv = FALSE, iter.details = TRUE, verbose = FALSE, mc.cores = 1,
...)
{
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
if (is.null(ncol(X))) {
X <- as.matrix(X)
}
params <- c(as.list(environment()), list(...))
if (!is.null(seednum)) {
set.seed(seednum)
}
stopifnot(nrow(X) == nrow(Y))
n <- nrow(X)
k <- ncol(Y)
p <- ncol(X)
if (is.null(colnames(X))) {
colnames(X) <- paste("X", 1:p, sep = "")
}
if (is.null(colnames(Y))) {
colnames(Y) <- paste("Y", 1:k, sep = "")
}
xnames <- colnames(X)
ynames <- colnames(Y)
if (is.null(s)) {
s <- sample(1:n, floor(n * train.fraction), replace = F)
}
if (any(is.na(Y))) {
stop("NAs not allowed in outcome variables.")
}
if (shrinkage > 1 | shrinkage <= 0) {
stop("shrinkage should be > 0, < 1")
}
if (train.fraction > 1 | train.fraction <= 0) {
stop("train.fraction should be > 0, < 1")
}
if (bag.fraction > 1 | bag.fraction <= 0) {
stop("bag.fraction should be > 0, < 1")
}
trainerr <- testerr <- vector(length = n.trees)
if (cv.folds > 1) {
ocv <- mvtbCV(Y = Y, X = X, cv.folds = cv.folds, s = s,
save.cv = save.cv, mc.cores = mc.cores, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, seednum = seednum)
best.iters.cv <- ocv$best.iters.cv
cv.err <- ocv$cv.err
out.fit <- ocv$models.k[[cv.folds + 1]]
}
else {
out.fit <- mvtb.fit(Y = Y, X = X, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, s = s, seednum = seednum, ...)
best.iters.cv <- NULL
cv.err <- NULL
ocv <- NULL
}
models <- out.fit$models
trainerr <- out.fit$trainerr
testerr <- out.fit$testerr
best.trees <- list(best.testerr = which.min(testerr), best.cv = best.iters.cv,
last = n.trees)
if (!save.cv) {
ocv <- NULL
}
if (iter.details == T) {
fl <- list(models = models, best.trees = best.trees,
params = params, trainerr = trainerr, testerr = testerr,
cv.err = cv.err, ocv = ocv, s = s, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
else {
fl <- list(models = models, best.trees = best.trees,
params = params, s = s, ocv = ocv, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
if (compress) {
fl <- lapply(fl, comp)
}
class(fl) <- "mvtb"
return(fl)
}
<bytecode: 0x9646e08>
<environment: namespace:mvtboost>
--- function search by body ---
Function mvtb in namespace mvtboost has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
mvtboost
--- call from context ---
mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = 2)
--- call from argument ---
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
--- R stacktrace ---
where 1: mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = 2)
where 2: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
where 3: withCallingHandlers({
code
NULL
}, error = function(cnd) {
if (can_entrace(cnd)) {
cnd <- cnd_entrace(cnd)
}
return_from(env, cnd)
})
where 4: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)),
...)
where 5: quasi_capture(enquo(object), label, capture_error, entrace = TRUE)
where 6 at testthat/test_params.R#137: expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = 2))
where 7: eval(code, test_env)
where 8: eval(code, test_env)
where 9: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 10: doTryCatch(return(expr), name, parentenv, handler)
where 11: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 12: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 13: doTryCatch(return(expr), name, parentenv, handler)
where 14: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 15: tryCatchList(expr, classes, parentenv, handlers)
where 16: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 17: test_code(desc, code, env = parent.frame())
where 18 at testthat/test_params.R#127: test_that("checks", {
expect_error(mvtb(X = X, Y = Y, n.trees = 50, shrinkage = 2))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, shrinkage = 0))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, shrinkage = -1))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, train.fraction = 2))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, train.fraction = 0))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, train.fraction = -1))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = -1))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = 0))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = 2))
Y[1, 1] <- NA
expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = 2))
})
where 19: eval(code, test_env)
where 20: eval(code, test_env)
where 21: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 22: doTryCatch(return(expr), name, parentenv, handler)
where 23: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 24: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 25: doTryCatch(return(expr), name, parentenv, handler)
where 26: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 27: tryCatchList(expr, classes, parentenv, handlers)
where 28: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 29: test_code(NULL, exprs, env)
where 30: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 31: force(code)
where 32: doWithOneRestart(return(expr), restart)
where 33: withOneRestart(expr, restarts[[1L]])
where 34: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 35: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
{
reporter$start_file(basename(path))
lister$start_file(basename(path))
source_file(path, new.env(parent = env), chdir = TRUE,
wrap = wrap)
reporter$.end_context()
reporter$end_file()
})
where 36: FUN(X[[i]], ...)
where 37: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 38: force(code)
where 39: doWithOneRestart(return(expr), restart)
where 40: withOneRestart(expr, restarts[[1L]])
where 41: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 42: with_reporter(reporter = current_reporter, results <- lapply(paths,
test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
load_helpers = FALSE, wrap = wrap))
where 43: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 44: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
wrap = wrap)
where 45: test_package_dir(package = package, test_path = test_path, filter = filter,
reporter = reporter, ..., stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 46: test_check("mvtboost")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (Y, X, n.trees = 100, shrinkage = 0.01, interaction.depth = 1,
distribution = "gaussian", train.fraction = 1, bag.fraction = 1,
cv.folds = 1, s = NULL, seednum = NULL, compress = FALSE,
save.cv = FALSE, iter.details = TRUE, verbose = FALSE, mc.cores = 1,
...)
{
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
if (is.null(ncol(X))) {
X <- as.matrix(X)
}
params <- c(as.list(environment()), list(...))
if (!is.null(seednum)) {
set.seed(seednum)
}
stopifnot(nrow(X) == nrow(Y))
n <- nrow(X)
k <- ncol(Y)
p <- ncol(X)
if (is.null(colnames(X))) {
colnames(X) <- paste("X", 1:p, sep = "")
}
if (is.null(colnames(Y))) {
colnames(Y) <- paste("Y", 1:k, sep = "")
}
xnames <- colnames(X)
ynames <- colnames(Y)
if (is.null(s)) {
s <- sample(1:n, floor(n * train.fraction), replace = F)
}
if (any(is.na(Y))) {
stop("NAs not allowed in outcome variables.")
}
if (shrinkage > 1 | shrinkage <= 0) {
stop("shrinkage should be > 0, < 1")
}
if (train.fraction > 1 | train.fraction <= 0) {
stop("train.fraction should be > 0, < 1")
}
if (bag.fraction > 1 | bag.fraction <= 0) {
stop("bag.fraction should be > 0, < 1")
}
trainerr <- testerr <- vector(length = n.trees)
if (cv.folds > 1) {
ocv <- mvtbCV(Y = Y, X = X, cv.folds = cv.folds, s = s,
save.cv = save.cv, mc.cores = mc.cores, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, seednum = seednum)
best.iters.cv <- ocv$best.iters.cv
cv.err <- ocv$cv.err
out.fit <- ocv$models.k[[cv.folds + 1]]
}
else {
out.fit <- mvtb.fit(Y = Y, X = X, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, s = s, seednum = seednum, ...)
best.iters.cv <- NULL
cv.err <- NULL
ocv <- NULL
}
models <- out.fit$models
trainerr <- out.fit$trainerr
testerr <- out.fit$testerr
best.trees <- list(best.testerr = which.min(testerr), best.cv = best.iters.cv,
last = n.trees)
if (!save.cv) {
ocv <- NULL
}
if (iter.details == T) {
fl <- list(models = models, best.trees = best.trees,
params = params, trainerr = trainerr, testerr = testerr,
cv.err = cv.err, ocv = ocv, s = s, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
else {
fl <- list(models = models, best.trees = best.trees,
params = params, s = s, ocv = ocv, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
if (compress) {
fl <- lapply(fl, comp)
}
class(fl) <- "mvtb"
return(fl)
}
<bytecode: 0x9646e08>
<environment: namespace:mvtboost>
--- function search by body ---
Function mvtb in namespace mvtboost has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
mvtboost
--- call from context ---
mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = 2)
--- call from argument ---
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
--- R stacktrace ---
where 1: mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = 2)
where 2: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
where 3: withCallingHandlers({
code
NULL
}, error = function(cnd) {
if (can_entrace(cnd)) {
cnd <- cnd_entrace(cnd)
}
return_from(env, cnd)
})
where 4: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)),
...)
where 5: quasi_capture(enquo(object), label, capture_error, entrace = TRUE)
where 6 at testthat/test_params.R#139: expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = 2))
where 7: eval(code, test_env)
where 8: eval(code, test_env)
where 9: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 10: doTryCatch(return(expr), name, parentenv, handler)
where 11: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 12: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 13: doTryCatch(return(expr), name, parentenv, handler)
where 14: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 15: tryCatchList(expr, classes, parentenv, handlers)
where 16: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 17: test_code(desc, code, env = parent.frame())
where 18 at testthat/test_params.R#127: test_that("checks", {
expect_error(mvtb(X = X, Y = Y, n.trees = 50, shrinkage = 2))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, shrinkage = 0))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, shrinkage = -1))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, train.fraction = 2))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, train.fraction = 0))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, train.fraction = -1))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = -1))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = 0))
expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = 2))
Y[1, 1] <- NA
expect_error(mvtb(X = X, Y = Y, n.trees = 50, bag.fraction = 2))
})
where 19: eval(code, test_env)
where 20: eval(code, test_env)
where 21: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 22: doTryCatch(return(expr), name, parentenv, handler)
where 23: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 24: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 25: doTryCatch(return(expr), name, parentenv, handler)
where 26: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 27: tryCatchList(expr, classes, parentenv, handlers)
where 28: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 29: test_code(NULL, exprs, env)
where 30: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 31: force(code)
where 32: doWithOneRestart(return(expr), restart)
where 33: withOneRestart(expr, restarts[[1L]])
where 34: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 35: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
{
reporter$start_file(basename(path))
lister$start_file(basename(path))
source_file(path, new.env(parent = env), chdir = TRUE,
wrap = wrap)
reporter$.end_context()
reporter$end_file()
})
where 36: FUN(X[[i]], ...)
where 37: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 38: force(code)
where 39: doWithOneRestart(return(expr), restart)
where 40: withOneRestart(expr, restarts[[1L]])
where 41: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 42: with_reporter(reporter = current_reporter, results <- lapply(paths,
test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
load_helpers = FALSE, wrap = wrap))
where 43: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 44: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
wrap = wrap)
where 45: test_package_dir(package = package, test_path = test_path, filter = filter,
reporter = reporter, ..., stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 46: test_check("mvtboost")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (Y, X, n.trees = 100, shrinkage = 0.01, interaction.depth = 1,
distribution = "gaussian", train.fraction = 1, bag.fraction = 1,
cv.folds = 1, s = NULL, seednum = NULL, compress = FALSE,
save.cv = FALSE, iter.details = TRUE, verbose = FALSE, mc.cores = 1,
...)
{
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
if (is.null(ncol(X))) {
X <- as.matrix(X)
}
params <- c(as.list(environment()), list(...))
if (!is.null(seednum)) {
set.seed(seednum)
}
stopifnot(nrow(X) == nrow(Y))
n <- nrow(X)
k <- ncol(Y)
p <- ncol(X)
if (is.null(colnames(X))) {
colnames(X) <- paste("X", 1:p, sep = "")
}
if (is.null(colnames(Y))) {
colnames(Y) <- paste("Y", 1:k, sep = "")
}
xnames <- colnames(X)
ynames <- colnames(Y)
if (is.null(s)) {
s <- sample(1:n, floor(n * train.fraction), replace = F)
}
if (any(is.na(Y))) {
stop("NAs not allowed in outcome variables.")
}
if (shrinkage > 1 | shrinkage <= 0) {
stop("shrinkage should be > 0, < 1")
}
if (train.fraction > 1 | train.fraction <= 0) {
stop("train.fraction should be > 0, < 1")
}
if (bag.fraction > 1 | bag.fraction <= 0) {
stop("bag.fraction should be > 0, < 1")
}
trainerr <- testerr <- vector(length = n.trees)
if (cv.folds > 1) {
ocv <- mvtbCV(Y = Y, X = X, cv.folds = cv.folds, s = s,
save.cv = save.cv, mc.cores = mc.cores, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, seednum = seednum)
best.iters.cv <- ocv$best.iters.cv
cv.err <- ocv$cv.err
out.fit <- ocv$models.k[[cv.folds + 1]]
}
else {
out.fit <- mvtb.fit(Y = Y, X = X, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, s = s, seednum = seednum, ...)
best.iters.cv <- NULL
cv.err <- NULL
ocv <- NULL
}
models <- out.fit$models
trainerr <- out.fit$trainerr
testerr <- out.fit$testerr
best.trees <- list(best.testerr = which.min(testerr), best.cv = best.iters.cv,
last = n.trees)
if (!save.cv) {
ocv <- NULL
}
if (iter.details == T) {
fl <- list(models = models, best.trees = best.trees,
params = params, trainerr = trainerr, testerr = testerr,
cv.err = cv.err, ocv = ocv, s = s, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
else {
fl <- list(models = models, best.trees = best.trees,
params = params, s = s, ocv = ocv, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
if (compress) {
fl <- lapply(fl, comp)
}
class(fl) <- "mvtb"
return(fl)
}
<bytecode: 0x9646e08>
<environment: namespace:mvtboost>
--- function search by body ---
Function mvtb in namespace mvtboost has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
mvtboost
--- call from context ---
mvtb(Y = Y, X = X)
--- call from argument ---
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
--- R stacktrace ---
where 1: mvtb(Y = Y, X = X)
where 2: eval_bare(expr, quo_get_env(quo))
where 3: quasi_label(enquo(object), label, arg = "object")
where 4 at testthat/test_params.R#158: expect_is(mvtb(Y = Y, X = X), "mvtb")
where 5: eval(code, test_env)
where 6: eval(code, test_env)
where 7: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 8: doTryCatch(return(expr), name, parentenv, handler)
where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 11: doTryCatch(return(expr), name, parentenv, handler)
where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 13: tryCatchList(expr, classes, parentenv, handlers)
where 14: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 15: test_code(desc, code, env = parent.frame())
where 16 at testthat/test_params.R#142: test_that("input", {
Y <- X %*% B + E
Xf <- as.data.frame(X)
Yf <- as.data.frame(Y)
out <- try(mvtb(Y = Yf, X = Xf))
expect_is(out, "mvtb")
set.seed(123)
n <- 1000
B <- matrix(0, nrow = 1, ncol = 4)
B[1, 1:2] <- 1
X <- matrix(rbinom(n, size = 1, prob = 0.5), n, nrow(B))
E <- matrix(rnorm(n * 4), nrow = n, ncol = 4)
Y <- X %*% B + E
expect_is(mvtb(Y = Y, X = X), "mvtb")
expect_is(mvtb(Y = Y, X = as.data.frame(X)), "mvtb")
Xf <- as.factor(X)
expect_is(mvtb(Y = Y, X = as.data.frame(X)), "mvtb")
set.seed(123)
n <- 1000
B <- matrix(0, nrow = 1, ncol = 1)
B[1, 1] <- 1
X <- matrix(rbinom(n, size = 1, prob = 0.5), n, nrow(B))
E <- matrix(rnorm(n * nrow(B)), nrow = n, ncol = nrow(B))
Y <- X %*% B + E
expect_is(mvtb(Y = Y, X = X), "mvtb")
set.seed(123)
n <- 1000
B <- matrix(0, nrow = 1, ncol = 1)
B[1, 1] <- 1
X <- matrix(rbinom(n, size = 1, prob = 0.5), n, nrow(B))
E <- matrix(rnorm(n * nrow(B)), nrow = n, ncol = nrow(B))
Y <- X %*% B + E
yf <- as.numeric(Y < 0)
expect_is(mvtb(Y = yf, X = X, distribution = "bernoulli"),
"mvtb")
expect_is(mvtb(Y = Y[, , drop = TRUE], X = X[, , drop = TRUE]),
"mvtb")
x <- rnorm(1000)
y <- x * 5 + rnorm(1000)
expect_is(mvtb(Y = y, X = x), "mvtb")
})
where 17: eval(code, test_env)
where 18: eval(code, test_env)
where 19: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 20: doTryCatch(return(expr), name, parentenv, handler)
where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 23: doTryCatch(return(expr), name, parentenv, handler)
where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 25: tryCatchList(expr, classes, parentenv, handlers)
where 26: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 27: test_code(NULL, exprs, env)
where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 29: force(code)
where 30: doWithOneRestart(return(expr), restart)
where 31: withOneRestart(expr, restarts[[1L]])
where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 33: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
{
reporter$start_file(basename(path))
lister$start_file(basename(path))
source_file(path, new.env(parent = env), chdir = TRUE,
wrap = wrap)
reporter$.end_context()
reporter$end_file()
})
where 34: FUN(X[[i]], ...)
where 35: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 36: force(code)
where 37: doWithOneRestart(return(expr), restart)
where 38: withOneRestart(expr, restarts[[1L]])
where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 40: with_reporter(reporter = current_reporter, results <- lapply(paths,
test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
load_helpers = FALSE, wrap = wrap))
where 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 42: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
wrap = wrap)
where 43: test_package_dir(package = package, test_path = test_path, filter = filter,
reporter = reporter, ..., stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 44: test_check("mvtboost")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (Y, X, n.trees = 100, shrinkage = 0.01, interaction.depth = 1,
distribution = "gaussian", train.fraction = 1, bag.fraction = 1,
cv.folds = 1, s = NULL, seednum = NULL, compress = FALSE,
save.cv = FALSE, iter.details = TRUE, verbose = FALSE, mc.cores = 1,
...)
{
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
if (is.null(ncol(X))) {
X <- as.matrix(X)
}
params <- c(as.list(environment()), list(...))
if (!is.null(seednum)) {
set.seed(seednum)
}
stopifnot(nrow(X) == nrow(Y))
n <- nrow(X)
k <- ncol(Y)
p <- ncol(X)
if (is.null(colnames(X))) {
colnames(X) <- paste("X", 1:p, sep = "")
}
if (is.null(colnames(Y))) {
colnames(Y) <- paste("Y", 1:k, sep = "")
}
xnames <- colnames(X)
ynames <- colnames(Y)
if (is.null(s)) {
s <- sample(1:n, floor(n * train.fraction), replace = F)
}
if (any(is.na(Y))) {
stop("NAs not allowed in outcome variables.")
}
if (shrinkage > 1 | shrinkage <= 0) {
stop("shrinkage should be > 0, < 1")
}
if (train.fraction > 1 | train.fraction <= 0) {
stop("train.fraction should be > 0, < 1")
}
if (bag.fraction > 1 | bag.fraction <= 0) {
stop("bag.fraction should be > 0, < 1")
}
trainerr <- testerr <- vector(length = n.trees)
if (cv.folds > 1) {
ocv <- mvtbCV(Y = Y, X = X, cv.folds = cv.folds, s = s,
save.cv = save.cv, mc.cores = mc.cores, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, seednum = seednum)
best.iters.cv <- ocv$best.iters.cv
cv.err <- ocv$cv.err
out.fit <- ocv$models.k[[cv.folds + 1]]
}
else {
out.fit <- mvtb.fit(Y = Y, X = X, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, s = s, seednum = seednum, ...)
best.iters.cv <- NULL
cv.err <- NULL
ocv <- NULL
}
models <- out.fit$models
trainerr <- out.fit$trainerr
testerr <- out.fit$testerr
best.trees <- list(best.testerr = which.min(testerr), best.cv = best.iters.cv,
last = n.trees)
if (!save.cv) {
ocv <- NULL
}
if (iter.details == T) {
fl <- list(models = models, best.trees = best.trees,
params = params, trainerr = trainerr, testerr = testerr,
cv.err = cv.err, ocv = ocv, s = s, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
else {
fl <- list(models = models, best.trees = best.trees,
params = params, s = s, ocv = ocv, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
if (compress) {
fl <- lapply(fl, comp)
}
class(fl) <- "mvtb"
return(fl)
}
<bytecode: 0x9646e08>
<environment: namespace:mvtboost>
--- function search by body ---
Function mvtb in namespace mvtboost has this body.
----------- END OF FAILURE REPORT --------------
-- 18. Error: input (@test_params.R#158) --------------------------------------
the condition has length > 1
Backtrace:
1. testthat::expect_is(mvtb(Y = Y, X = X), "mvtb")
4. mvtboost::mvtb(Y = Y, X = X)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
mvtboost
--- call from context ---
mvtb(Y = Y, X = X, n.trees = 100, shrinkage = 0.5)
--- call from argument ---
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
--- R stacktrace ---
where 1 at testthat/test_plot.R#18: mvtb(Y = Y, X = X, n.trees = 100, shrinkage = 0.5)
where 2: eval(code, test_env)
where 3: eval(code, test_env)
where 4: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 5: doTryCatch(return(expr), name, parentenv, handler)
where 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 7: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 8: doTryCatch(return(expr), name, parentenv, handler)
where 9: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 10: tryCatchList(expr, classes, parentenv, handlers)
where 11: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 12: test_code(NULL, exprs, env)
where 13: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 14: force(code)
where 15: doWithOneRestart(return(expr), restart)
where 16: withOneRestart(expr, restarts[[1L]])
where 17: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 18: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
{
reporter$start_file(basename(path))
lister$start_file(basename(path))
source_file(path, new.env(parent = env), chdir = TRUE,
wrap = wrap)
reporter$.end_context()
reporter$end_file()
})
where 19: FUN(X[[i]], ...)
where 20: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 21: force(code)
where 22: doWithOneRestart(return(expr), restart)
where 23: withOneRestart(expr, restarts[[1L]])
where 24: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 25: with_reporter(reporter = current_reporter, results <- lapply(paths,
test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
load_helpers = FALSE, wrap = wrap))
where 26: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 27: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
wrap = wrap)
where 28: test_package_dir(package = package, test_path = test_path, filter = filter,
reporter = reporter, ..., stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 29: test_check("mvtboost")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (Y, X, n.trees = 100, shrinkage = 0.01, interaction.depth = 1,
distribution = "gaussian", train.fraction = 1, bag.fraction = 1,
cv.folds = 1, s = NULL, seednum = NULL, compress = FALSE,
save.cv = FALSE, iter.details = TRUE, verbose = FALSE, mc.cores = 1,
...)
{
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
if (is.null(ncol(X))) {
X <- as.matrix(X)
}
params <- c(as.list(environment()), list(...))
if (!is.null(seednum)) {
set.seed(seednum)
}
stopifnot(nrow(X) == nrow(Y))
n <- nrow(X)
k <- ncol(Y)
p <- ncol(X)
if (is.null(colnames(X))) {
colnames(X) <- paste("X", 1:p, sep = "")
}
if (is.null(colnames(Y))) {
colnames(Y) <- paste("Y", 1:k, sep = "")
}
xnames <- colnames(X)
ynames <- colnames(Y)
if (is.null(s)) {
s <- sample(1:n, floor(n * train.fraction), replace = F)
}
if (any(is.na(Y))) {
stop("NAs not allowed in outcome variables.")
}
if (shrinkage > 1 | shrinkage <= 0) {
stop("shrinkage should be > 0, < 1")
}
if (train.fraction > 1 | train.fraction <= 0) {
stop("train.fraction should be > 0, < 1")
}
if (bag.fraction > 1 | bag.fraction <= 0) {
stop("bag.fraction should be > 0, < 1")
}
trainerr <- testerr <- vector(length = n.trees)
if (cv.folds > 1) {
ocv <- mvtbCV(Y = Y, X = X, cv.folds = cv.folds, s = s,
save.cv = save.cv, mc.cores = mc.cores, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, seednum = seednum)
best.iters.cv <- ocv$best.iters.cv
cv.err <- ocv$cv.err
out.fit <- ocv$models.k[[cv.folds + 1]]
}
else {
out.fit <- mvtb.fit(Y = Y, X = X, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, s = s, seednum = seednum, ...)
best.iters.cv <- NULL
cv.err <- NULL
ocv <- NULL
}
models <- out.fit$models
trainerr <- out.fit$trainerr
testerr <- out.fit$testerr
best.trees <- list(best.testerr = which.min(testerr), best.cv = best.iters.cv,
last = n.trees)
if (!save.cv) {
ocv <- NULL
}
if (iter.details == T) {
fl <- list(models = models, best.trees = best.trees,
params = params, trainerr = trainerr, testerr = testerr,
cv.err = cv.err, ocv = ocv, s = s, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
else {
fl <- list(models = models, best.trees = best.trees,
params = params, s = s, ocv = ocv, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
if (compress) {
fl <- lapply(fl, comp)
}
class(fl) <- "mvtb"
return(fl)
}
<bytecode: 0x9646e08>
<environment: namespace:mvtboost>
--- function search by body ---
Function mvtb in namespace mvtboost has this body.
----------- END OF FAILURE REPORT --------------
-- 19. Error: (unknown) (@test_plot.R#18) -------------------------------------
the condition has length > 1
Backtrace:
1. mvtboost::mvtb(Y = Y, X = X, n.trees = 100, shrinkage = 0.5)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
mvtboost
--- call from context ---
mvtb(X = Xf, Y = Y, n.trees = 50, interaction.depth = 3, shrinkage = 0.5,
bag.fraction = 1, train.fraction = 1, compress = FALSE, cv.folds = 1,
s = 1:1000)
--- call from argument ---
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
--- R stacktrace ---
where 1 at testthat/test_predict.R#19: mvtb(X = Xf, Y = Y, n.trees = 50, interaction.depth = 3, shrinkage = 0.5,
bag.fraction = 1, train.fraction = 1, compress = FALSE, cv.folds = 1,
s = 1:1000)
where 2: eval(code, test_env)
where 3: eval(code, test_env)
where 4: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 5: doTryCatch(return(expr), name, parentenv, handler)
where 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 7: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 8: doTryCatch(return(expr), name, parentenv, handler)
where 9: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 10: tryCatchList(expr, classes, parentenv, handlers)
where 11: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 12: test_code(NULL, exprs, env)
where 13: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 14: force(code)
where 15: doWithOneRestart(return(expr), restart)
where 16: withOneRestart(expr, restarts[[1L]])
where 17: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 18: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
{
reporter$start_file(basename(path))
lister$start_file(basename(path))
source_file(path, new.env(parent = env), chdir = TRUE,
wrap = wrap)
reporter$.end_context()
reporter$end_file()
})
where 19: FUN(X[[i]], ...)
where 20: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 21: force(code)
where 22: doWithOneRestart(return(expr), restart)
where 23: withOneRestart(expr, restarts[[1L]])
where 24: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 25: with_reporter(reporter = current_reporter, results <- lapply(paths,
test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
load_helpers = FALSE, wrap = wrap))
where 26: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 27: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
wrap = wrap)
where 28: test_package_dir(package = package, test_path = test_path, filter = filter,
reporter = reporter, ..., stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 29: test_check("mvtboost")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (Y, X, n.trees = 100, shrinkage = 0.01, interaction.depth = 1,
distribution = "gaussian", train.fraction = 1, bag.fraction = 1,
cv.folds = 1, s = NULL, seednum = NULL, compress = FALSE,
save.cv = FALSE, iter.details = TRUE, verbose = FALSE, mc.cores = 1,
...)
{
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
if (is.null(ncol(X))) {
X <- as.matrix(X)
}
params <- c(as.list(environment()), list(...))
if (!is.null(seednum)) {
set.seed(seednum)
}
stopifnot(nrow(X) == nrow(Y))
n <- nrow(X)
k <- ncol(Y)
p <- ncol(X)
if (is.null(colnames(X))) {
colnames(X) <- paste("X", 1:p, sep = "")
}
if (is.null(colnames(Y))) {
colnames(Y) <- paste("Y", 1:k, sep = "")
}
xnames <- colnames(X)
ynames <- colnames(Y)
if (is.null(s)) {
s <- sample(1:n, floor(n * train.fraction), replace = F)
}
if (any(is.na(Y))) {
stop("NAs not allowed in outcome variables.")
}
if (shrinkage > 1 | shrinkage <= 0) {
stop("shrinkage should be > 0, < 1")
}
if (train.fraction > 1 | train.fraction <= 0) {
stop("train.fraction should be > 0, < 1")
}
if (bag.fraction > 1 | bag.fraction <= 0) {
stop("bag.fraction should be > 0, < 1")
}
trainerr <- testerr <- vector(length = n.trees)
if (cv.folds > 1) {
ocv <- mvtbCV(Y = Y, X = X, cv.folds = cv.folds, s = s,
save.cv = save.cv, mc.cores = mc.cores, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, seednum = seednum)
best.iters.cv <- ocv$best.iters.cv
cv.err <- ocv$cv.err
out.fit <- ocv$models.k[[cv.folds + 1]]
}
else {
out.fit <- mvtb.fit(Y = Y, X = X, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, s = s, seednum = seednum, ...)
best.iters.cv <- NULL
cv.err <- NULL
ocv <- NULL
}
models <- out.fit$models
trainerr <- out.fit$trainerr
testerr <- out.fit$testerr
best.trees <- list(best.testerr = which.min(testerr), best.cv = best.iters.cv,
last = n.trees)
if (!save.cv) {
ocv <- NULL
}
if (iter.details == T) {
fl <- list(models = models, best.trees = best.trees,
params = params, trainerr = trainerr, testerr = testerr,
cv.err = cv.err, ocv = ocv, s = s, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
else {
fl <- list(models = models, best.trees = best.trees,
params = params, s = s, ocv = ocv, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
if (compress) {
fl <- lapply(fl, comp)
}
class(fl) <- "mvtb"
return(fl)
}
<bytecode: 0x9646e08>
<environment: namespace:mvtboost>
--- function search by body ---
Function mvtb in namespace mvtboost has this body.
----------- END OF FAILURE REPORT --------------
-- 20. Error: (unknown) (@test_predict.R#19) ----------------------------------
the condition has length > 1
Backtrace:
1. mvtboost::mvtb(...)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
mvtboost
--- call from context ---
mvtb(Y = Y, X = X, shrinkage = 0.1, n.trees = 100)
--- call from argument ---
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
--- R stacktrace ---
where 1 at testthat/test_summary.R#19: mvtb(Y = Y, X = X, shrinkage = 0.1, n.trees = 100)
where 2: eval(code, test_env)
where 3: eval(code, test_env)
where 4: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 5: doTryCatch(return(expr), name, parentenv, handler)
where 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 7: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 8: doTryCatch(return(expr), name, parentenv, handler)
where 9: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 10: tryCatchList(expr, classes, parentenv, handlers)
where 11: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 12: test_code(NULL, exprs, env)
where 13: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 14: force(code)
where 15: doWithOneRestart(return(expr), restart)
where 16: withOneRestart(expr, restarts[[1L]])
where 17: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 18: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
{
reporter$start_file(basename(path))
lister$start_file(basename(path))
source_file(path, new.env(parent = env), chdir = TRUE,
wrap = wrap)
reporter$.end_context()
reporter$end_file()
})
where 19: FUN(X[[i]], ...)
where 20: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 21: force(code)
where 22: doWithOneRestart(return(expr), restart)
where 23: withOneRestart(expr, restarts[[1L]])
where 24: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 25: with_reporter(reporter = current_reporter, results <- lapply(paths,
test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
load_helpers = FALSE, wrap = wrap))
where 26: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 27: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
wrap = wrap)
where 28: test_package_dir(package = package, test_path = test_path, filter = filter,
reporter = reporter, ..., stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 29: test_check("mvtboost")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (Y, X, n.trees = 100, shrinkage = 0.01, interaction.depth = 1,
distribution = "gaussian", train.fraction = 1, bag.fraction = 1,
cv.folds = 1, s = NULL, seednum = NULL, compress = FALSE,
save.cv = FALSE, iter.details = TRUE, verbose = FALSE, mc.cores = 1,
...)
{
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
if (is.null(ncol(X))) {
X <- as.matrix(X)
}
params <- c(as.list(environment()), list(...))
if (!is.null(seednum)) {
set.seed(seednum)
}
stopifnot(nrow(X) == nrow(Y))
n <- nrow(X)
k <- ncol(Y)
p <- ncol(X)
if (is.null(colnames(X))) {
colnames(X) <- paste("X", 1:p, sep = "")
}
if (is.null(colnames(Y))) {
colnames(Y) <- paste("Y", 1:k, sep = "")
}
xnames <- colnames(X)
ynames <- colnames(Y)
if (is.null(s)) {
s <- sample(1:n, floor(n * train.fraction), replace = F)
}
if (any(is.na(Y))) {
stop("NAs not allowed in outcome variables.")
}
if (shrinkage > 1 | shrinkage <= 0) {
stop("shrinkage should be > 0, < 1")
}
if (train.fraction > 1 | train.fraction <= 0) {
stop("train.fraction should be > 0, < 1")
}
if (bag.fraction > 1 | bag.fraction <= 0) {
stop("bag.fraction should be > 0, < 1")
}
trainerr <- testerr <- vector(length = n.trees)
if (cv.folds > 1) {
ocv <- mvtbCV(Y = Y, X = X, cv.folds = cv.folds, s = s,
save.cv = save.cv, mc.cores = mc.cores, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, seednum = seednum)
best.iters.cv <- ocv$best.iters.cv
cv.err <- ocv$cv.err
out.fit <- ocv$models.k[[cv.folds + 1]]
}
else {
out.fit <- mvtb.fit(Y = Y, X = X, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, s = s, seednum = seednum, ...)
best.iters.cv <- NULL
cv.err <- NULL
ocv <- NULL
}
models <- out.fit$models
trainerr <- out.fit$trainerr
testerr <- out.fit$testerr
best.trees <- list(best.testerr = which.min(testerr), best.cv = best.iters.cv,
last = n.trees)
if (!save.cv) {
ocv <- NULL
}
if (iter.details == T) {
fl <- list(models = models, best.trees = best.trees,
params = params, trainerr = trainerr, testerr = testerr,
cv.err = cv.err, ocv = ocv, s = s, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
else {
fl <- list(models = models, best.trees = best.trees,
params = params, s = s, ocv = ocv, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
if (compress) {
fl <- lapply(fl, comp)
}
class(fl) <- "mvtb"
return(fl)
}
<bytecode: 0x9646e08>
<environment: namespace:mvtboost>
--- function search by body ---
Function mvtb in namespace mvtboost has this body.
----------- END OF FAILURE REPORT --------------
-- 21. Error: (unknown) (@test_summary.R#19) ----------------------------------
the condition has length > 1
Backtrace:
1. mvtboost::mvtb(Y = Y, X = X, shrinkage = 0.1, n.trees = 100)
== testthat results ===========================================================
[ OK: 18 | SKIPPED: 0 | WARNINGS: 37 | FAILED: 21 ]
1. Error: (unknown) (@test_covex.R#19)
2. Error: mvtb - CV param (@test_cv.R#54)
3. Error: final_model (@test_cv.R#89)
4. Error: (unknown) (@test_intx.R#16)
5. Error: n.trees (@test_params.R#13)
6. Error: train.fraction (@test_params.R#19)
7. Error: bag.fraction (@test_params.R#25)
8. Error: subsetting (@test_params.R#30)
9. Error: seednum (@test_params.R#35)
1. ...
Error: testthat unit tests failed
Execution halted
Flavor: r-devel-linux-x86_64-debian-clang
Version: 0.5.0
Check: re-building of vignette outputs
Result: WARN
Error(s) in re-building vignettes:
...
--- re-building 'mvtboost_vignette.Rmd' using rmarkdown
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
mvtboost
--- call from context ---
mvtb(Y = Ys, X = X, n.trees = 1000, shrinkage = 0.01, interaction.depth = 3)
--- call from argument ---
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
--- R stacktrace ---
where 1: mvtb(Y = Ys, X = X, n.trees = 1000, shrinkage = 0.01, interaction.depth = 3)
where 2: eval(expr, envir, enclos)
where 3: eval(expr, envir, enclos)
where 4: withVisible(eval(expr, envir, enclos))
where 5: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler,
error = eHandler, message = mHandler)
where 6: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir,
enclos)), warning = wHandler, error = eHandler, message = mHandler))
where 7: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr,
envir, enclos)), warning = wHandler, error = eHandler, message = mHandler)))
where 8: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos,
debug = debug, last = i == length(out), use_try = stop_on_error !=
2L, keep_warning = keep_warning, keep_message = keep_message,
output_handler = output_handler, include_timing = include_timing)
where 9: evaluate::evaluate(...)
where 10: evaluate(code, envir = env, new_device = FALSE, keep_warning = !isFALSE(options$warning),
keep_message = !isFALSE(options$message), stop_on_error = if (options$error &&
options$include) 0L else 2L, output_handler = knit_handlers(options$render,
options))
where 11: in_dir(input_dir(), evaluate(code, envir = env, new_device = FALSE,
keep_warning = !isFALSE(options$warning), keep_message = !isFALSE(options$message),
stop_on_error = if (options$error && options$include) 0L else 2L,
output_handler = knit_handlers(options$render, options)))
where 12: block_exec(params)
where 13: call_block(x)
where 14: process_group.block(group)
where 15: process_group(group)
where 16: withCallingHandlers(if (tangle) process_tangle(group) else process_group(group),
error = function(e) {
setwd(wd)
cat(res, sep = "\n", file = output %n% "")
message("Quitting from lines ", paste(current_lines(i),
collapse = "-"), " (", knit_concord$get("infile"),
") ")
})
where 17: process_file(text, output)
where 18: knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
where 19: rmarkdown::render(file, encoding = encoding, quiet = quiet, envir = globalenv(),
...)
where 20: vweave_rmarkdown(...)
where 21: engine$weave(file, quiet = quiet, encoding = enc)
where 22: doTryCatch(return(expr), name, parentenv, handler)
where 23: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 24: tryCatchList(expr, classes, parentenv, handlers)
where 25: tryCatch({
engine$weave(file, quiet = quiet, encoding = enc)
setwd(startdir)
output <- find_vignette_product(name, by = "weave", engine = engine)
if (!have.makefile && vignette_is_tex(output)) {
texi2pdf(file = output, clean = FALSE, quiet = quiet)
output <- find_vignette_product(name, by = "texi2pdf",
engine = engine)
}
}, error = function(e) {
OK <<- FALSE
message(gettextf("Error: processing vignette '%s' failed with diagnostics:\n%s",
file, conditionMessage(e)))
})
where 26: tools:::.buildOneVignette("mvtboost_vignette.Rmd", "/home/hornik/tmp/R.check/r-devel-clang/Work/PKGS/mvtboost.Rcheck/vign_test/mvtboost",
TRUE, FALSE, "mvtboost_vignette", "UTF-8", "/tmp/RtmpNh6sXT/filedbc2fcc7cab.rds")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (Y, X, n.trees = 100, shrinkage = 0.01, interaction.depth = 1,
distribution = "gaussian", train.fraction = 1, bag.fraction = 1,
cv.folds = 1, s = NULL, seednum = NULL, compress = FALSE,
save.cv = FALSE, iter.details = TRUE, verbose = FALSE, mc.cores = 1,
...)
{
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
if (is.null(ncol(X))) {
X <- as.matrix(X)
}
params <- c(as.list(environment()), list(...))
if (!is.null(seednum)) {
set.seed(seednum)
}
stopifnot(nrow(X) == nrow(Y))
n <- nrow(X)
k <- ncol(Y)
p <- ncol(X)
if (is.null(colnames(X))) {
colnames(X) <- paste("X", 1:p, sep = "")
}
if (is.null(colnames(Y))) {
colnames(Y) <- paste("Y", 1:k, sep = "")
}
xnames <- colnames(X)
ynames <- colnames(Y)
if (is.null(s)) {
s <- sample(1:n, floor(n * train.fraction), replace = F)
}
if (any(is.na(Y))) {
stop("NAs not allowed in outcome variables.")
}
if (shrinkage > 1 | shrinkage <= 0) {
stop("shrinkage should be > 0, < 1")
}
if (train.fraction > 1 | train.fraction <= 0) {
stop("train.fraction should be > 0, < 1")
}
if (bag.fraction > 1 | bag.fraction <= 0) {
stop("bag.fraction should be > 0, < 1")
}
trainerr <- testerr <- vector(length = n.trees)
if (cv.folds > 1) {
ocv <- mvtbCV(Y = Y, X = X, cv.folds = cv.folds, s = s,
save.cv = save.cv, mc.cores = mc.cores, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, seednum = seednum)
best.iters.cv <- ocv$best.iters.cv
cv.err <- ocv$cv.err
out.fit <- ocv$models.k[[cv.folds + 1]]
}
else {
out.fit <- mvtb.fit(Y = Y, X = X, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, s = s, seednum = seednum, ...)
best.iters.cv <- NULL
cv.err <- NULL
ocv <- NULL
}
models <- out.fit$models
trainerr <- out.fit$trainerr
testerr <- out.fit$testerr
best.trees <- list(best.testerr = which.min(testerr), best.cv = best.iters.cv,
last = n.trees)
if (!save.cv) {
ocv <- NULL
}
if (iter.details == T) {
fl <- list(models = models, best.trees = best.trees,
params = params, trainerr = trainerr, testerr = testerr,
cv.err = cv.err, ocv = ocv, s = s, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
else {
fl <- list(models = models, best.trees = best.trees,
params = params, s = s, ocv = ocv, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
if (compress) {
fl <- lapply(fl, comp)
}
class(fl) <- "mvtb"
return(fl)
}
<bytecode: 0x9aa36d0>
<environment: namespace:mvtboost>
--- function search by body ---
Function mvtb in namespace mvtboost has this body.
----------- END OF FAILURE REPORT --------------
Quitting from lines 31-43 (mvtboost_vignette.Rmd)
Error: processing vignette 'mvtboost_vignette.Rmd' failed with diagnostics:
the condition has length > 1
--- failed re-building 'mvtboost_vignette.Rmd'
--- re-building 'mvtboost_wellbeing.Rmd' using rmarkdown
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
mvtboost
--- call from context ---
mvtb(Y = Ys, X = Xs)
--- call from argument ---
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
--- R stacktrace ---
where 1: mvtb(Y = Ys, X = Xs)
where 2: eval(expr, envir, enclos)
where 3: eval(expr, envir, enclos)
where 4: withVisible(eval(expr, envir, enclos))
where 5: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler,
error = eHandler, message = mHandler)
where 6: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir,
enclos)), warning = wHandler, error = eHandler, message = mHandler))
where 7: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr,
envir, enclos)), warning = wHandler, error = eHandler, message = mHandler)))
where 8: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos,
debug = debug, last = i == length(out), use_try = stop_on_error !=
2L, keep_warning = keep_warning, keep_message = keep_message,
output_handler = output_handler, include_timing = include_timing)
where 9: evaluate::evaluate(...)
where 10: evaluate(code, envir = env, new_device = FALSE, keep_warning = !isFALSE(options$warning),
keep_message = !isFALSE(options$message), stop_on_error = if (options$error &&
options$include) 0L else 2L, output_handler = knit_handlers(options$render,
options))
where 11: in_dir(input_dir(), evaluate(code, envir = env, new_device = FALSE,
keep_warning = !isFALSE(options$warning), keep_message = !isFALSE(options$message),
stop_on_error = if (options$error && options$include) 0L else 2L,
output_handler = knit_handlers(options$render, options)))
where 12: block_exec(params)
where 13: call_block(x)
where 14: process_group.block(group)
where 15: process_group(group)
where 16: withCallingHandlers(if (tangle) process_tangle(group) else process_group(group),
error = function(e) {
setwd(wd)
cat(res, sep = "\n", file = output %n% "")
message("Quitting from lines ", paste(current_lines(i),
collapse = "-"), " (", knit_concord$get("infile"),
") ")
})
where 17: process_file(text, output)
where 18: knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
where 19: rmarkdown::render(file, encoding = encoding, quiet = quiet, envir = globalenv(),
...)
where 20: vweave_rmarkdown(...)
where 21: engine$weave(file, quiet = quiet, encoding = enc)
where 22: doTryCatch(return(expr), name, parentenv, handler)
where 23: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 24: tryCatchList(expr, classes, parentenv, handlers)
where 25: tryCatch({
engine$weave(file, quiet = quiet, encoding = enc)
setwd(startdir)
output <- find_vignette_product(name, by = "weave", engine = engine)
if (!have.makefile && vignette_is_tex(output)) {
texi2pdf(file = output, clean = FALSE, quiet = quiet)
output <- find_vignette_product(name, by = "texi2pdf",
engine = engine)
}
}, error = function(e) {
OK <<- FALSE
message(gettextf("Error: processing vignette '%s' failed with diagnostics:\n%s",
file, conditionMessage(e)))
})
where 26: tools:::.buildOneVignette("mvtboost_wellbeing.Rmd", "/home/hornik/tmp/R.check/r-devel-clang/Work/PKGS/mvtboost.Rcheck/vign_test/mvtboost",
TRUE, FALSE, "mvtboost_wellbeing", "UTF-8", "/tmp/RtmpNh6sXT/filedbc51c5f83.rds")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (Y, X, n.trees = 100, shrinkage = 0.01, interaction.depth = 1,
distribution = "gaussian", train.fraction = 1, bag.fraction = 1,
cv.folds = 1, s = NULL, seednum = NULL, compress = FALSE,
save.cv = FALSE, iter.details = TRUE, verbose = FALSE, mc.cores = 1,
...)
{
if (class(Y) != "matrix") {
Y <- as.matrix(Y)
}
if (is.null(ncol(X))) {
X <- as.matrix(X)
}
params <- c(as.list(environment()), list(...))
if (!is.null(seednum)) {
set.seed(seednum)
}
stopifnot(nrow(X) == nrow(Y))
n <- nrow(X)
k <- ncol(Y)
p <- ncol(X)
if (is.null(colnames(X))) {
colnames(X) <- paste("X", 1:p, sep = "")
}
if (is.null(colnames(Y))) {
colnames(Y) <- paste("Y", 1:k, sep = "")
}
xnames <- colnames(X)
ynames <- colnames(Y)
if (is.null(s)) {
s <- sample(1:n, floor(n * train.fraction), replace = F)
}
if (any(is.na(Y))) {
stop("NAs not allowed in outcome variables.")
}
if (shrinkage > 1 | shrinkage <= 0) {
stop("shrinkage should be > 0, < 1")
}
if (train.fraction > 1 | train.fraction <= 0) {
stop("train.fraction should be > 0, < 1")
}
if (bag.fraction > 1 | bag.fraction <= 0) {
stop("bag.fraction should be > 0, < 1")
}
trainerr <- testerr <- vector(length = n.trees)
if (cv.folds > 1) {
ocv <- mvtbCV(Y = Y, X = X, cv.folds = cv.folds, s = s,
save.cv = save.cv, mc.cores = mc.cores, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, seednum = seednum)
best.iters.cv <- ocv$best.iters.cv
cv.err <- ocv$cv.err
out.fit <- ocv$models.k[[cv.folds + 1]]
}
else {
out.fit <- mvtb.fit(Y = Y, X = X, n.trees = n.trees,
shrinkage = shrinkage, interaction.depth = interaction.depth,
distribution = distribution, bag.fraction = bag.fraction,
verbose = verbose, s = s, seednum = seednum, ...)
best.iters.cv <- NULL
cv.err <- NULL
ocv <- NULL
}
models <- out.fit$models
trainerr <- out.fit$trainerr
testerr <- out.fit$testerr
best.trees <- list(best.testerr = which.min(testerr), best.cv = best.iters.cv,
last = n.trees)
if (!save.cv) {
ocv <- NULL
}
if (iter.details == T) {
fl <- list(models = models, best.trees = best.trees,
params = params, trainerr = trainerr, testerr = testerr,
cv.err = cv.err, ocv = ocv, s = s, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
else {
fl <- list(models = models, best.trees = best.trees,
params = params, s = s, ocv = ocv, n = nrow(X), xnames = colnames(X),
ynames = colnames(Y))
}
if (compress) {
fl <- lapply(fl, comp)
}
class(fl) <- "mvtb"
return(fl)
}
<bytecode: 0xb8458a0>
<environment: namespace:mvtboost>
--- function search by body ---
Function mvtb in namespace mvtboost has this body.
----------- END OF FAILURE REPORT --------------
Quitting from lines 25-40 (mvtboost_wellbeing.Rmd)
Error: processing vignette 'mvtboost_wellbeing.Rmd' failed with diagnostics:
the condition has length > 1
--- failed re-building 'mvtboost_wellbeing.Rmd'
SUMMARY: processing the following files failed:
'mvtboost_vignette.Rmd' 'mvtboost_wellbeing.Rmd'
Error: Vignette re-building failed.
Execution halted
Flavor: r-devel-linux-x86_64-debian-clang
Version: 0.5.0
Check: tests
Result: ERROR
Running ‘testthat.R’ [53s/79s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
> library(testthat)
> library(mvtboost)
>
> test_check("mvtboost")
── 1. Failure: verbose (@test_params.R#79) ────────────────────────────────────
`mvtb(...)` produced warnings.
══ testthat results ═══════════════════════════════════════════════════════════
[ OK: 174 | SKIPPED: 1 | WARNINGS: 803 | FAILED: 1 ]
1. Failure: verbose (@test_params.R#79)
Error: testthat unit tests failed
Execution halted
Flavor: r-devel-linux-x86_64-debian-gcc