Last updated on 2019-12-15 05:47:34 CET.
Flavor | Version | Tinstall | Tcheck | Ttotal | Status | Flags |
---|---|---|---|---|---|---|
r-devel-linux-x86_64-debian-clang | 2.0.0 | 14.48 | 337.15 | 351.63 | ERROR | |
r-devel-linux-x86_64-debian-gcc | 2.0.1 | 12.09 | 308.43 | 320.52 | OK | |
r-devel-linux-x86_64-fedora-clang | 2.0.1 | 513.89 | OK | |||
r-devel-linux-x86_64-fedora-gcc | 2.0.1 | 430.26 | OK | |||
r-devel-windows-ix86+x86_64 | 2.0.1 | 41.00 | 448.00 | 489.00 | OK | |
r-devel-windows-ix86+x86_64-gcc8 | 2.0.0 | 32.00 | 454.00 | 486.00 | OK | |
r-patched-linux-x86_64 | 2.0.1 | 13.35 | 344.39 | 357.74 | OK | |
r-patched-solaris-x86 | 2.0.1 | 560.10 | OK | |||
r-release-linux-x86_64 | 2.0.1 | 12.46 | 342.46 | 354.92 | OK | |
r-release-windows-ix86+x86_64 | 2.0.0 | 24.00 | 336.00 | 360.00 | OK | |
r-release-osx-x86_64 | 2.0.1 | OK | ||||
r-oldrel-windows-ix86+x86_64 | 2.0.1 | 15.00 | 311.00 | 326.00 | OK | |
r-oldrel-osx-x86_64 | 2.0.1 | OK |
Version: 2.0.0
Check: tests
Result: ERROR
Running 'testthat.R' [190s/180s]
Running the tests in 'tests/testthat.R' failed.
Complete output:
> library(testthat)
> library(caretEnsemble)
>
> test_check("caretEnsemble")
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
caretEnsemble
--- call from context ---
predict.caretList(models)
--- call from argument ---
if (class(preds) != "matrix" & class(preds) != "data.frame") {
if (class(preds) == "character" | class(preds) == "factor") {
preds <- as.character(preds)
}
preds <- as.matrix(t(preds))
}
--- R stacktrace ---
where 1: predict.caretList(models)
where 2: predict(models)
where 3: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
where 4: withCallingHandlers(code, warning = function(condition) {
out$push(condition)
maybe_restart("muffleWarning")
})
where 5: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)),
...)
where 6: quasi_capture(enquo(object), label, capture_warnings)
where 7 at testthat/test-caretList.R#109: expect_warning(p1 <- predict(models))
where 8: eval(code, test_env)
where 9: eval(code, test_env)
where 10: 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 11: doTryCatch(return(expr), name, parentenv, handler)
where 12: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 13: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 14: doTryCatch(return(expr), name, parentenv, handler)
where 15: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 16: tryCatchList(expr, classes, parentenv, handlers)
where 17: 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 18: test_code(desc, code, env = parent.frame())
where 19 at testthat/test-caretList.R#94: test_that("caretList predictions", {
skip_if_not_installed("randomForest")
skip_if_not_installed("nnet")
skip_if_not_installed("plyr")
expect_warning({
models <- caretList(iris[, 1:2], iris[, 5], tuneLength = 1,
verbose = FALSE, methodList = "rf", tuneList = list(nnet = caretModelSpec(method = "nnet",
trace = FALSE)), trControl = trainControl(method = "cv",
number = 2, savePredictions = "final", classProbs = FALSE))
})
expect_warning(p1 <- predict(models))
p2 <- predict(models, newdata = iris[100, c(1:2)])
p3 <- predict(models, newdata = iris[110, c(1:2)])
expect_is(p1, "matrix")
expect_is(p1[, 1], "character")
expect_is(p1[, 2], "character")
expect_equal(names(models), colnames(p1))
expect_is(p2, "matrix")
expect_is(p2[, 1], "character")
expect_is(p2[, 2], "character")
expect_equal(names(models), colnames(p2))
expect_is(p3, "matrix")
expect_is(p3[, 1], "character")
expect_is(p3[, 2], "character")
expect_equal(names(models), colnames(p3))
expect_warning({
models <- caretList(iris[, 1:2], iris[, 5], tuneLength = 1,
verbose = FALSE, methodList = "rf", tuneList = list(nnet = caretModelSpec(method = "nnet",
trace = FALSE)), trControl = trainControl(method = "cv",
number = 2, savePredictions = "final", classProbs = TRUE))
})
expect_warning(p2 <- predict(models))
p3 <- predict(models, newdata = iris[100, c(1:2)])
expect_is(p2, "matrix")
expect_is(p2[, 1], "numeric")
expect_is(p2[, 2], "numeric")
expect_is(p3, "matrix")
expect_is(p3[, 1], "numeric")
expect_is(p3[, 2], "numeric")
expect_equal(names(models), colnames(p3))
models[[1]]$modelType <- "Bogus"
expect_error(expect_warning(predict(models)))
})
where 20: eval(code, test_env)
where 21: eval(code, test_env)
where 22: 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 23: doTryCatch(return(expr), name, parentenv, handler)
where 24: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 25: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 26: doTryCatch(return(expr), name, parentenv, handler)
where 27: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 28: tryCatchList(expr, classes, parentenv, handlers)
where 29: 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 30: test_code(NULL, exprs, env)
where 31: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 32: force(code)
where 33: doWithOneRestart(return(expr), restart)
where 34: withOneRestart(expr, restarts[[1L]])
where 35: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 36: 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 37: FUN(X[[i]], ...)
where 38: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 39: force(code)
where 40: doWithOneRestart(return(expr), restart)
where 41: withOneRestart(expr, restarts[[1L]])
where 42: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 43: 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 44: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 45: 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 46: 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 47: test_check("caretEnsemble")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (object, newdata = NULL, ..., verbose = FALSE)
{
if (is.null(newdata)) {
warning("Predicting without new data is not well supported. Attempting to predict on the training data.")
newdata <- object[[1]]$trainingData
if (is.null(newdata)) {
stop("Could not find training data in the first model in the ensemble.")
}
}
if (verbose == TRUE) {
pboptions(type = "txt", char = "*")
}
else if (verbose == FALSE) {
pboptions(type = "none")
}
preds <- pbsapply(object, function(x) {
type <- x$modelType
if (type == "Classification") {
if (x$control$classProbs) {
caret::predict.train(x, type = "prob", newdata = newdata,
...)[, 2]
}
else {
caret::predict.train(x, type = "raw", newdata = newdata,
...)
}
}
else if (type == "Regression") {
caret::predict.train(x, type = "raw", newdata = newdata,
...)
}
else {
stop(paste("Unknown model type:", type))
}
})
if (class(preds) != "matrix" & class(preds) != "data.frame") {
if (class(preds) == "character" | class(preds) == "factor") {
preds <- as.character(preds)
}
preds <- as.matrix(t(preds))
}
colnames(preds) <- make.names(sapply(object, function(x) x$method),
unique = TRUE)
return(preds)
}
<bytecode: 0xcda46f8>
<environment: namespace:caretEnsemble>
--- function search by body ---
Function predict.caretList in namespace caretEnsemble has this body.
----------- END OF FAILURE REPORT --------------
-- 1. Error: caretList predictions (@test-caretList.R#109) --------------------
the condition has length > 1
Backtrace:
1. testthat::expect_warning(p1 <- predict(models))
7. caretEnsemble:::predict.caretList(models)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
caretEnsemble
--- call from context ---
predict.caretList(object$models, newdata = newdata)
--- call from argument ---
if (class(preds) != "matrix" & class(preds) != "data.frame") {
if (class(preds) == "character" | class(preds) == "factor") {
preds <- as.character(preds)
}
preds <- as.matrix(t(preds))
}
--- R stacktrace ---
where 1: predict.caretList(object$models, newdata = newdata)
where 2: predict(object$models, newdata = newdata)
where 3: predict.caretStack(ens.reg, newdata = X.reg)
where 4: predict(ens.reg, newdata = X.reg)
where 5: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
where 6: withCallingHandlers(code, warning = function(condition) {
out$push(condition)
maybe_restart("muffleWarning")
})
where 7: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)),
...)
where 8: quasi_capture(enquo(object), label, capture_warnings)
where 9 at testthat/test-caretStack.R#23: expect_warning(pred.reg <- predict(ens.reg, newdata = X.reg))
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-caretStack.R#14: test_that("We can stack regression models", {
set.seed(96367)
ens.reg <- caretStack(models.reg, method = "lm", preProcess = "pca",
trControl = trainControl(number = 2, allowParallel = FALSE))
expect_that(ens.reg, is_a("caretStack"))
expect_is(summary(ens.reg), "summary.lm")
sink <- capture.output(print(ens.reg))
expect_warning(pred.reg <- predict(ens.reg, newdata = X.reg))
expect_true(is.numeric(pred.reg))
expect_true(length(pred.reg) == 150)
})
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("caretEnsemble")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (object, newdata = NULL, ..., verbose = FALSE)
{
if (is.null(newdata)) {
warning("Predicting without new data is not well supported. Attempting to predict on the training data.")
newdata <- object[[1]]$trainingData
if (is.null(newdata)) {
stop("Could not find training data in the first model in the ensemble.")
}
}
if (verbose == TRUE) {
pboptions(type = "txt", char = "*")
}
else if (verbose == FALSE) {
pboptions(type = "none")
}
preds <- pbsapply(object, function(x) {
type <- x$modelType
if (type == "Classification") {
if (x$control$classProbs) {
caret::predict.train(x, type = "prob", newdata = newdata,
...)[, 2]
}
else {
caret::predict.train(x, type = "raw", newdata = newdata,
...)
}
}
else if (type == "Regression") {
caret::predict.train(x, type = "raw", newdata = newdata,
...)
}
else {
stop(paste("Unknown model type:", type))
}
})
if (class(preds) != "matrix" & class(preds) != "data.frame") {
if (class(preds) == "character" | class(preds) == "factor") {
preds <- as.character(preds)
}
preds <- as.matrix(t(preds))
}
colnames(preds) <- make.names(sapply(object, function(x) x$method),
unique = TRUE)
return(preds)
}
<bytecode: 0xcda46f8>
<environment: namespace:caretEnsemble>
--- function search by body ---
Function predict.caretList in namespace caretEnsemble has this body.
----------- END OF FAILURE REPORT --------------
-- 2. Error: We can stack regression models (@test-caretStack.R#23) -----------
the condition has length > 1
Backtrace:
1. testthat::expect_warning(pred.reg <- predict(ens.reg, newdata = X.reg))
7. caretEnsemble:::predict.caretStack(ens.reg, newdata = X.reg)
9. caretEnsemble:::predict.caretList(object$models, newdata = newdata)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
caretEnsemble
--- call from context ---
predict.caretList(object$models, newdata = newdata)
--- call from argument ---
if (class(preds) != "matrix" & class(preds) != "data.frame") {
if (class(preds) == "character" | class(preds) == "factor") {
preds <- as.character(preds)
}
preds <- as.matrix(t(preds))
}
--- R stacktrace ---
where 1: predict.caretList(object$models, newdata = newdata)
where 2: predict(object$models, newdata = newdata)
where 3: predict.caretStack(ens.class, X.class, type = "prob")
where 4: predict(ens.class, X.class, type = "prob")
where 5: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
where 6: withCallingHandlers(code, warning = function(condition) {
out$push(condition)
maybe_restart("muffleWarning")
})
where 7: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)),
...)
where 8: quasi_capture(enquo(object), label, capture_warnings)
where 9 at testthat/test-caretStack.R#36: expect_warning(pred.class <- predict(ens.class, X.class, type = "prob"))
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-caretStack.R#28: test_that("We can stack classification models", {
set.seed(42)
ens.class <- caretStack(models.class, method = "glm", trControl = trainControl(number = 2,
allowParallel = FALSE))
expect_that(ens.class, is_a("caretStack"))
expect_is(summary(ens.class), "summary.glm")
sink <- capture.output(print(ens.class))
expect_warning(pred.class <- predict(ens.class, X.class,
type = "prob"))
expect_true(is.numeric(pred.class))
expect_true(length(pred.class) == 150)
expect_warning(raw.class <- predict(ens.class, X.class, type = "raw"))
expect_true(is.factor(raw.class))
expect_true(length(raw.class) == 150)
})
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("caretEnsemble")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (object, newdata = NULL, ..., verbose = FALSE)
{
if (is.null(newdata)) {
warning("Predicting without new data is not well supported. Attempting to predict on the training data.")
newdata <- object[[1]]$trainingData
if (is.null(newdata)) {
stop("Could not find training data in the first model in the ensemble.")
}
}
if (verbose == TRUE) {
pboptions(type = "txt", char = "*")
}
else if (verbose == FALSE) {
pboptions(type = "none")
}
preds <- pbsapply(object, function(x) {
type <- x$modelType
if (type == "Classification") {
if (x$control$classProbs) {
caret::predict.train(x, type = "prob", newdata = newdata,
...)[, 2]
}
else {
caret::predict.train(x, type = "raw", newdata = newdata,
...)
}
}
else if (type == "Regression") {
caret::predict.train(x, type = "raw", newdata = newdata,
...)
}
else {
stop(paste("Unknown model type:", type))
}
})
if (class(preds) != "matrix" & class(preds) != "data.frame") {
if (class(preds) == "character" | class(preds) == "factor") {
preds <- as.character(preds)
}
preds <- as.matrix(t(preds))
}
colnames(preds) <- make.names(sapply(object, function(x) x$method),
unique = TRUE)
return(preds)
}
<bytecode: 0xcda46f8>
<environment: namespace:caretEnsemble>
--- function search by body ---
Function predict.caretList in namespace caretEnsemble has this body.
----------- END OF FAILURE REPORT --------------
-- 3. Error: We can stack classification models (@test-caretStack.R#36) -------
the condition has length > 1
Backtrace:
1. testthat::expect_warning(...)
7. caretEnsemble:::predict.caretStack(ens.class, X.class, type = "prob")
9. caretEnsemble:::predict.caretList(object$models, newdata = newdata)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
caretEnsemble
--- call from context ---
predict.caretList(object$models, newdata = newdata)
--- call from argument ---
if (class(preds) != "matrix" & class(preds) != "data.frame") {
if (class(preds) == "character" | class(preds) == "factor") {
preds <- as.character(preds)
}
preds <- as.matrix(t(preds))
}
--- R stacktrace ---
where 1: predict.caretList(object$models, newdata = newdata)
where 2: predict(object$models, newdata = newdata)
where 3: predict.caretStack(ens.class, X.class, type = "raw", se = TRUE)
where 4: predict(ens.class, X.class, type = "raw", se = TRUE)
where 5: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
where 6: withCallingHandlers(code, message = function(condition) {
out$push(condition)
maybe_restart("muffleMessage")
})
where 7: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)),
...)
where 8: quasi_capture(enquo(object), label, capture_messages)
where 9 at testthat/test-caretStack.R#64: expect_message(predict(ens.class, X.class, type = "raw", se = TRUE))
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-caretStack.R#59: test_that("Failure to calculate se occurs gracefully", {
ens.class <- caretStack(models.class, method = "glm", trControl = trainControl(number = 2,
allowParallel = FALSE))
expect_message(predict(ens.class, X.class, type = "raw",
se = TRUE))
expect_warning(expect_is(predict(ens.class, X.class, type = "raw"),
"factor"))
expect_warning(expect_is(predict(ens.class, X.class, type = "raw",
se = TRUE), "factor"))
expect_warning({
expect_identical(predict(ens.class, X.class, type = "raw",
se = TRUE), predict(ens.class, X.class, type = "raw"))
})
ens.reg <- caretStack(models.reg, method = "lm", preProcess = "pca",
trControl = trainControl(number = 2, allowParallel = FALSE))
expect_warning(pred <- predict(ens.reg, X.reg, se = TRUE))
expect_warning(expect_is(predict(ens.reg, X.reg, se = TRUE),
"data.frame"))
expect_warning(expect_is(predict(ens.class, X.class, type = "prob",
se = TRUE), "data.frame"))
expect_warning(expect_is(predict(ens.class, X.class, type = "prob",
se = TRUE, return_weights = TRUE), "data.frame"))
expect_warning(expect_identical(colnames(predict(ens.class,
X.class, type = "prob", se = TRUE)), c("fit", "lwr",
"upr")))
expect_warning(expect_false(identical(predict(ens.class,
X.class, type = "raw", return_weights = TRUE), predict(ens.class,
X.class, type = "raw", return_weights = FALSE))))
expect_warning(expect_false(identical(predict(ens.class,
X.class, type = "prob", se = TRUE, level = 0.8), predict(ens.class,
X.class, type = "prob", se = TRUE, return_weights = FALSE))))
expect_warning(expect_true(identical(predict(ens.class, X.class,
type = "prob", level = 0.8), predict(ens.class, X.class,
type = "prob", return_weights = FALSE))))
})
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("caretEnsemble")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (object, newdata = NULL, ..., verbose = FALSE)
{
if (is.null(newdata)) {
warning("Predicting without new data is not well supported. Attempting to predict on the training data.")
newdata <- object[[1]]$trainingData
if (is.null(newdata)) {
stop("Could not find training data in the first model in the ensemble.")
}
}
if (verbose == TRUE) {
pboptions(type = "txt", char = "*")
}
else if (verbose == FALSE) {
pboptions(type = "none")
}
preds <- pbsapply(object, function(x) {
type <- x$modelType
if (type == "Classification") {
if (x$control$classProbs) {
caret::predict.train(x, type = "prob", newdata = newdata,
...)[, 2]
}
else {
caret::predict.train(x, type = "raw", newdata = newdata,
...)
}
}
else if (type == "Regression") {
caret::predict.train(x, type = "raw", newdata = newdata,
...)
}
else {
stop(paste("Unknown model type:", type))
}
})
if (class(preds) != "matrix" & class(preds) != "data.frame") {
if (class(preds) == "character" | class(preds) == "factor") {
preds <- as.character(preds)
}
preds <- as.matrix(t(preds))
}
colnames(preds) <- make.names(sapply(object, function(x) x$method),
unique = TRUE)
return(preds)
}
<bytecode: 0xcda46f8>
<environment: namespace:caretEnsemble>
--- function search by body ---
Function predict.caretList in namespace caretEnsemble has this body.
----------- END OF FAILURE REPORT --------------
-- 4. Error: Failure to calculate se occurs gracefully (@test-caretStack.R#64)
the condition has length > 1
Backtrace:
1. testthat::expect_message(...)
7. caretEnsemble:::predict.caretStack(...)
9. caretEnsemble:::predict.caretList(object$models, newdata = newdata)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
caretEnsemble
--- call from context ---
predict.caretList(object$models, newdata = newdata)
--- call from argument ---
if (class(preds) != "matrix" & class(preds) != "data.frame") {
if (class(preds) == "character" | class(preds) == "factor") {
preds <- as.character(preds)
}
preds <- as.matrix(t(preds))
}
--- R stacktrace ---
where 1: predict.caretList(object$models, newdata = newdata)
where 2: predict(object$models, newdata = newdata)
where 3: predict.caretStack(object, type = "prob")
where 4: predict(object, type = "prob")
where 5: residuals.caretEnsemble(ens)
where 6: residuals(ens)
where 7: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
where 8: withCallingHandlers(code, warning = function(condition) {
out$push(condition)
maybe_restart("muffleWarning")
})
where 9: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)),
...)
where 10: quasi_capture(enquo(object), label, capture_warnings)
where 11 at testthat/test-ensemble.R#43: expect_warning(r <- residuals(ens))
where 12: eval(code, test_env)
where 13: eval(code, test_env)
where 14: 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 15: doTryCatch(return(expr), name, parentenv, handler)
where 16: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 17: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 18: doTryCatch(return(expr), name, parentenv, handler)
where 19: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 20: tryCatchList(expr, classes, parentenv, handlers)
where 21: 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 22: test_code(desc, code, env = parent.frame())
where 23 at testthat/test-ensemble.R#41: test_that("We can extract resdiuals from caretEnsemble objects",
{
ens <- caretEnsemble(models.class)
expect_warning(r <- residuals(ens))
expect_is(r, "numeric")
expect_equal(length(r), 150)
ens <- caretEnsemble(models.reg)
expect_warning(r <- residuals(ens))
expect_is(r, "numeric")
expect_equal(length(r), 150)
})
where 24: eval(code, test_env)
where 25: eval(code, test_env)
where 26: 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 27: doTryCatch(return(expr), name, parentenv, handler)
where 28: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 29: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 30: doTryCatch(return(expr), name, parentenv, handler)
where 31: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 32: tryCatchList(expr, classes, parentenv, handlers)
where 33: 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 34: test_code(NULL, exprs, env)
where 35: source_file(path, new.env(parent = env), chdir = TRUE, 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 = 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 41: FUN(X[[i]], ...)
where 42: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 43: force(code)
where 44: doWithOneRestart(return(expr), restart)
where 45: withOneRestart(expr, restarts[[1L]])
where 46: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 47: 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 48: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 49: 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 50: 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 51: test_check("caretEnsemble")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (object, newdata = NULL, ..., verbose = FALSE)
{
if (is.null(newdata)) {
warning("Predicting without new data is not well supported. Attempting to predict on the training data.")
newdata <- object[[1]]$trainingData
if (is.null(newdata)) {
stop("Could not find training data in the first model in the ensemble.")
}
}
if (verbose == TRUE) {
pboptions(type = "txt", char = "*")
}
else if (verbose == FALSE) {
pboptions(type = "none")
}
preds <- pbsapply(object, function(x) {
type <- x$modelType
if (type == "Classification") {
if (x$control$classProbs) {
caret::predict.train(x, type = "prob", newdata = newdata,
...)[, 2]
}
else {
caret::predict.train(x, type = "raw", newdata = newdata,
...)
}
}
else if (type == "Regression") {
caret::predict.train(x, type = "raw", newdata = newdata,
...)
}
else {
stop(paste("Unknown model type:", type))
}
})
if (class(preds) != "matrix" & class(preds) != "data.frame") {
if (class(preds) == "character" | class(preds) == "factor") {
preds <- as.character(preds)
}
preds <- as.matrix(t(preds))
}
colnames(preds) <- make.names(sapply(object, function(x) x$method),
unique = TRUE)
return(preds)
}
<bytecode: 0xcda46f8>
<environment: namespace:caretEnsemble>
--- function search by body ---
Function predict.caretList in namespace caretEnsemble has this body.
----------- END OF FAILURE REPORT --------------
-- 5. Error: We can extract resdiuals from caretEnsemble objects (@test-ensemble
the condition has length > 1
Backtrace:
1. testthat::expect_warning(r <- residuals(ens))
7. caretEnsemble:::residuals.caretEnsemble(ens)
9. caretEnsemble:::predict.caretStack(object, type = "prob")
11. caretEnsemble:::predict.caretList(object$models, newdata = newdata)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
caretEnsemble
--- call from context ---
predict.caretList(object$models, newdata = newdata)
--- call from argument ---
if (class(preds) != "matrix" & class(preds) != "data.frame") {
if (class(preds) == "character" | class(preds) == "factor") {
preds <- as.character(preds)
}
preds <- as.matrix(t(preds))
}
--- R stacktrace ---
where 1: predict.caretList(object$models, newdata = newdata)
where 2: predict(object$models, newdata = newdata)
where 3: predict.caretStack(ens.reg)
where 4: predict(ens.reg)
where 5: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
where 6: withCallingHandlers(code, warning = function(condition) {
out$push(condition)
maybe_restart("muffleWarning")
})
where 7: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)),
...)
where 8: quasi_capture(enquo(object), label, capture_warnings)
where 9 at testthat/test-ensemble.R#79: expect_warning(pred.reg <- predict(ens.reg))
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-ensemble.R#76: test_that("We can ensemble regression models", {
ens.reg <- caretEnsemble(models.reg, trControl = trainControl(number = 2))
expect_that(ens.reg, is_a("caretEnsemble"))
expect_warning(pred.reg <- predict(ens.reg))
expect_warning(pred.reg2 <- predict(ens.reg, se = TRUE))
expect_true(all(pred.reg == pred.reg2$fit))
expect_warning(expect_error(predict(ens.reg, return_weights = "BOGUS")))
expect_true(is.numeric(pred.reg))
expect_true(length(pred.reg) == 150)
ens.class <- caretEnsemble(models.class, trControl = trainControl(number = 2))
expect_that(ens.class, is_a("caretEnsemble"))
expect_warning(pred.class <- predict(ens.class, type = "prob"))
expect_true(is.numeric(pred.class))
expect_true(length(pred.class) == 150)
expect_warning(p1 <- predict(ens.reg, return_weights = TRUE,
se = FALSE))
expect_is(attr(p1, which = "weights"), "numeric")
expect_is(p1, "numeric")
expect_warning(p2 <- predict(ens.reg, return_weights = TRUE,
se = TRUE))
expect_is(attr(p2, which = "weights"), "numeric")
expect_is(p2, "data.frame")
expect_equal(ncol(p2), 3)
expect_identical(names(p2), c("fit", "lwr", "upr"))
expect_warning(p3 <- predict(ens.reg, return_weights = FALSE,
se = FALSE))
expect_is(p3, "numeric")
expect_true(all(p1 == p3))
expect_false(identical(p1, p3))
expect_true(all(p2$fit == p1))
expect_true(all(p2$fit == p3))
expect_null(attr(p3, which = "weights"))
})
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("caretEnsemble")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (object, newdata = NULL, ..., verbose = FALSE)
{
if (is.null(newdata)) {
warning("Predicting without new data is not well supported. Attempting to predict on the training data.")
newdata <- object[[1]]$trainingData
if (is.null(newdata)) {
stop("Could not find training data in the first model in the ensemble.")
}
}
if (verbose == TRUE) {
pboptions(type = "txt", char = "*")
}
else if (verbose == FALSE) {
pboptions(type = "none")
}
preds <- pbsapply(object, function(x) {
type <- x$modelType
if (type == "Classification") {
if (x$control$classProbs) {
caret::predict.train(x, type = "prob", newdata = newdata,
...)[, 2]
}
else {
caret::predict.train(x, type = "raw", newdata = newdata,
...)
}
}
else if (type == "Regression") {
caret::predict.train(x, type = "raw", newdata = newdata,
...)
}
else {
stop(paste("Unknown model type:", type))
}
})
if (class(preds) != "matrix" & class(preds) != "data.frame") {
if (class(preds) == "character" | class(preds) == "factor") {
preds <- as.character(preds)
}
preds <- as.matrix(t(preds))
}
colnames(preds) <- make.names(sapply(object, function(x) x$method),
unique = TRUE)
return(preds)
}
<bytecode: 0xcda46f8>
<environment: namespace:caretEnsemble>
--- function search by body ---
Function predict.caretList in namespace caretEnsemble has this body.
----------- END OF FAILURE REPORT --------------
-- 6. Error: We can ensemble regression models (@test-ensemble.R#79) ----------
the condition has length > 1
Backtrace:
1. testthat::expect_warning(pred.reg <- predict(ens.reg))
7. caretEnsemble:::predict.caretStack(ens.reg)
9. caretEnsemble:::predict.caretList(object$models, newdata = newdata)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
caretEnsemble
--- call from context ---
predict.caretList(object$models, newdata = newdata)
--- call from argument ---
if (class(preds) != "matrix" & class(preds) != "data.frame") {
if (class(preds) == "character" | class(preds) == "factor") {
preds <- as.character(preds)
}
preds <- as.matrix(t(preds))
}
--- R stacktrace ---
where 1: predict.caretList(object$models, newdata = newdata)
where 2: predict(object$models, newdata = newdata)
where 3: predict.caretStack(ens.reg)
where 4: predict(ens.reg)
where 5: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
where 6: withCallingHandlers(code, warning = function(condition) {
out$push(condition)
maybe_restart("muffleWarning")
})
where 7: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)),
...)
where 8: quasi_capture(enquo(object), label, capture_warnings)
where 9 at testthat/test-ensemble.R#160: expect_warning(pred.reg <- predict(ens.reg))
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-ensemble.R#156: test_that("It works for regression models", {
set.seed(1234)
ens.reg <- caretEnsemble(models.reg, trControl = trainControl(number = 2))
expect_is(ens.reg, "caretEnsemble")
expect_warning(pred.reg <- predict(ens.reg))
newPreds1 <- as.data.frame(X.reg)
expect_warning(pred.regb <- predict(ens.reg, newdata = newPreds1))
expect_warning(pred.regc <- predict(ens.reg, newdata = newPreds1[2,
]))
expect_identical(pred.reg, pred.regb)
expect_less_than(abs(4.740135 - pred.regc), 0.01)
expect_is(pred.reg, "numeric")
expect_is(pred.regb, "numeric")
expect_is(pred.regc, "numeric")
expect_equal(length(pred.regc), 1)
})
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("caretEnsemble")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (object, newdata = NULL, ..., verbose = FALSE)
{
if (is.null(newdata)) {
warning("Predicting without new data is not well supported. Attempting to predict on the training data.")
newdata <- object[[1]]$trainingData
if (is.null(newdata)) {
stop("Could not find training data in the first model in the ensemble.")
}
}
if (verbose == TRUE) {
pboptions(type = "txt", char = "*")
}
else if (verbose == FALSE) {
pboptions(type = "none")
}
preds <- pbsapply(object, function(x) {
type <- x$modelType
if (type == "Classification") {
if (x$control$classProbs) {
caret::predict.train(x, type = "prob", newdata = newdata,
...)[, 2]
}
else {
caret::predict.train(x, type = "raw", newdata = newdata,
...)
}
}
else if (type == "Regression") {
caret::predict.train(x, type = "raw", newdata = newdata,
...)
}
else {
stop(paste("Unknown model type:", type))
}
})
if (class(preds) != "matrix" & class(preds) != "data.frame") {
if (class(preds) == "character" | class(preds) == "factor") {
preds <- as.character(preds)
}
preds <- as.matrix(t(preds))
}
colnames(preds) <- make.names(sapply(object, function(x) x$method),
unique = TRUE)
return(preds)
}
<bytecode: 0xcda46f8>
<environment: namespace:caretEnsemble>
--- function search by body ---
Function predict.caretList in namespace caretEnsemble has this body.
----------- END OF FAILURE REPORT --------------
-- 7. Error: It works for regression models (@test-ensemble.R#160) ------------
the condition has length > 1
Backtrace:
1. testthat::expect_warning(pred.reg <- predict(ens.reg))
7. caretEnsemble:::predict.caretStack(ens.reg)
9. caretEnsemble:::predict.caretList(object$models, newdata = newdata)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
caretEnsemble
--- call from context ---
predict.caretList(object$models, newdata = newdata)
--- call from argument ---
if (class(preds) != "matrix" & class(preds) != "data.frame") {
if (class(preds) == "character" | class(preds) == "factor") {
preds <- as.character(preds)
}
preds <- as.matrix(t(preds))
}
--- R stacktrace ---
where 1: predict.caretList(object$models, newdata = newdata)
where 2: predict(object$models, newdata = newdata)
where 3: predict.caretStack(ens.class, type = "prob")
where 4: predict(ens.class, type = "prob")
where 5: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
where 6: withCallingHandlers(code, warning = function(condition) {
out$push(condition)
maybe_restart("muffleWarning")
})
where 7: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)),
...)
where 8: quasi_capture(enquo(object), label, capture_warnings)
where 9 at testthat/test-ensemble.R#176: expect_warning(pred.class <- predict(ens.class, type = "prob"))
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-ensemble.R#172: test_that("It works for classification models", {
set.seed(1234)
ens.class <- caretEnsemble(models.class, trControl = trainControl(number = 2))
expect_that(ens.class, is_a("caretEnsemble"))
expect_warning(pred.class <- predict(ens.class, type = "prob"))
newPreds1 <- as.data.frame(X.class)
expect_warning(pred.classb <- predict(ens.class, newdata = newPreds1,
type = "prob"))
expect_warning(pred.classc <- predict(ens.class, newdata = newPreds1[2,
], type = "prob"))
expect_true(is.numeric(pred.class))
expect_true(length(pred.class) == 150)
expect_identical(pred.class, pred.classb)
expect_less_than(abs(0.03727609 - pred.classc), 0.01)
expect_is(pred.class, "numeric")
expect_is(pred.classb, "numeric")
expect_is(pred.classc, "numeric")
expect_equal(length(pred.classc), 1)
})
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("caretEnsemble")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (object, newdata = NULL, ..., verbose = FALSE)
{
if (is.null(newdata)) {
warning("Predicting without new data is not well supported. Attempting to predict on the training data.")
newdata <- object[[1]]$trainingData
if (is.null(newdata)) {
stop("Could not find training data in the first model in the ensemble.")
}
}
if (verbose == TRUE) {
pboptions(type = "txt", char = "*")
}
else if (verbose == FALSE) {
pboptions(type = "none")
}
preds <- pbsapply(object, function(x) {
type <- x$modelType
if (type == "Classification") {
if (x$control$classProbs) {
caret::predict.train(x, type = "prob", newdata = newdata,
...)[, 2]
}
else {
caret::predict.train(x, type = "raw", newdata = newdata,
...)
}
}
else if (type == "Regression") {
caret::predict.train(x, type = "raw", newdata = newdata,
...)
}
else {
stop(paste("Unknown model type:", type))
}
})
if (class(preds) != "matrix" & class(preds) != "data.frame") {
if (class(preds) == "character" | class(preds) == "factor") {
preds <- as.character(preds)
}
preds <- as.matrix(t(preds))
}
colnames(preds) <- make.names(sapply(object, function(x) x$method),
unique = TRUE)
return(preds)
}
<bytecode: 0xcda46f8>
<environment: namespace:caretEnsemble>
--- function search by body ---
Function predict.caretList in namespace caretEnsemble has this body.
----------- END OF FAILURE REPORT --------------
-- 8. Error: It works for classification models (@test-ensemble.R#176) --------
the condition has length > 1
Backtrace:
1. testthat::expect_warning(pred.class <- predict(ens.class, type = "prob"))
7. caretEnsemble:::predict.caretStack(ens.class, type = "prob")
9. caretEnsemble:::predict.caretList(object$models, newdata = newdata)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
caretEnsemble
--- call from context ---
predict.caretList(models.reg, "reg", newdata = X.reg)
--- call from argument ---
if (class(preds) != "matrix" & class(preds) != "data.frame") {
if (class(preds) == "character" | class(preds) == "factor") {
preds <- as.character(preds)
}
preds <- as.matrix(t(preds))
}
--- R stacktrace ---
where 1: predict.caretList(models.reg, "reg", newdata = X.reg)
where 2: predict(models.reg, "reg", newdata = X.reg)
where 3: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
where 4: withCallingHandlers(code, warning = function(condition) {
out$push(condition)
maybe_restart("muffleWarning")
})
where 5: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)),
...)
where 6: quasi_capture(enquo(object), label, capture_warnings)
where 7 at testthat/test-helper_functions.R#63: expect_warning(out <- predict(models.reg, "reg", newdata = X.reg))
where 8: eval(code, test_env)
where 9: eval(code, test_env)
where 10: 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 11: doTryCatch(return(expr), name, parentenv, handler)
where 12: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 13: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 14: doTryCatch(return(expr), name, parentenv, handler)
where 15: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 16: tryCatchList(expr, classes, parentenv, handlers)
where 17: 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 18: test_code(desc, code, env = parent.frame())
where 19 at testthat/test-helper_functions.R#62: test_that("We can predict", {
expect_warning(out <- predict(models.reg, "reg", newdata = X.reg))
expect_is(out, "matrix")
expect_true(all(dim(out) == c(150, 4)))
expect_true(all(colnames(out) == c("rf", "glm", "rpart",
"treebag")))
})
where 20: eval(code, test_env)
where 21: eval(code, test_env)
where 22: 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 23: doTryCatch(return(expr), name, parentenv, handler)
where 24: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 25: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 26: doTryCatch(return(expr), name, parentenv, handler)
where 27: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 28: tryCatchList(expr, classes, parentenv, handlers)
where 29: 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 30: test_code(NULL, exprs, env)
where 31: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 32: force(code)
where 33: doWithOneRestart(return(expr), restart)
where 34: withOneRestart(expr, restarts[[1L]])
where 35: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 36: 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 37: FUN(X[[i]], ...)
where 38: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 39: force(code)
where 40: doWithOneRestart(return(expr), restart)
where 41: withOneRestart(expr, restarts[[1L]])
where 42: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 43: 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 44: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 45: 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 46: 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 47: test_check("caretEnsemble")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (object, newdata = NULL, ..., verbose = FALSE)
{
if (is.null(newdata)) {
warning("Predicting without new data is not well supported. Attempting to predict on the training data.")
newdata <- object[[1]]$trainingData
if (is.null(newdata)) {
stop("Could not find training data in the first model in the ensemble.")
}
}
if (verbose == TRUE) {
pboptions(type = "txt", char = "*")
}
else if (verbose == FALSE) {
pboptions(type = "none")
}
preds <- pbsapply(object, function(x) {
type <- x$modelType
if (type == "Classification") {
if (x$control$classProbs) {
caret::predict.train(x, type = "prob", newdata = newdata,
...)[, 2]
}
else {
caret::predict.train(x, type = "raw", newdata = newdata,
...)
}
}
else if (type == "Regression") {
caret::predict.train(x, type = "raw", newdata = newdata,
...)
}
else {
stop(paste("Unknown model type:", type))
}
})
if (class(preds) != "matrix" & class(preds) != "data.frame") {
if (class(preds) == "character" | class(preds) == "factor") {
preds <- as.character(preds)
}
preds <- as.matrix(t(preds))
}
colnames(preds) <- make.names(sapply(object, function(x) x$method),
unique = TRUE)
return(preds)
}
<bytecode: 0xcda46f8>
<environment: namespace:caretEnsemble>
--- function search by body ---
Function predict.caretList in namespace caretEnsemble has this body.
----------- END OF FAILURE REPORT --------------
-- 9. Error: We can predict (@test-helper_functions.R#63) ---------------------
the condition has length > 1
Backtrace:
1. testthat::expect_warning(out <- predict(models.reg, "reg", newdata = X.reg))
7. caretEnsemble:::predict.caretList(models.reg, "reg", newdata = X.reg)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
caretEnsemble
--- call from context ---
predict.caretList(models.class, "Classification", newdata = X.class)
--- call from argument ---
if (class(preds) != "matrix" & class(preds) != "data.frame") {
if (class(preds) == "character" | class(preds) == "factor") {
preds <- as.character(preds)
}
preds <- as.matrix(t(preds))
}
--- R stacktrace ---
where 1: predict.caretList(models.class, "Classification", newdata = X.class)
where 2: predict(models.class, "Classification", newdata = X.class)
where 3: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
where 4: withCallingHandlers(code, warning = function(condition) {
out$push(condition)
maybe_restart("muffleWarning")
})
where 5: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)),
...)
where 6: quasi_capture(enquo(object), label, capture_warnings)
where 7 at testthat/test-helper_functions.R#81: expect_warning(out <- predict(models.class, "Classification",
newdata = X.class))
where 8: eval(code, test_env)
where 9: eval(code, test_env)
where 10: 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 11: doTryCatch(return(expr), name, parentenv, handler)
where 12: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 13: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 14: doTryCatch(return(expr), name, parentenv, handler)
where 15: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 16: tryCatchList(expr, classes, parentenv, handlers)
where 17: 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 18: test_code(desc, code, env = parent.frame())
where 19 at testthat/test-helper_functions.R#80: test_that("We can predict", {
expect_warning(out <- predict(models.class, "Classification",
newdata = X.class))
expect_is(out, "matrix")
expect_true(all(dim(out) == c(150, 4)))
expect_true(all(colnames(out) == c("rf", "glm", "rpart",
"treebag")))
expect_warning(out2 <- predict(models.reg, "Regression",
newdata = X.reg))
expect_true(all(dim(out2) == c(150, 4)))
expect_true(all(colnames(out2) == c("rf", "glm", "rpart",
"treebag")))
})
where 20: eval(code, test_env)
where 21: eval(code, test_env)
where 22: 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 23: doTryCatch(return(expr), name, parentenv, handler)
where 24: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 25: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 26: doTryCatch(return(expr), name, parentenv, handler)
where 27: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 28: tryCatchList(expr, classes, parentenv, handlers)
where 29: 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 30: test_code(NULL, exprs, env)
where 31: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 32: force(code)
where 33: doWithOneRestart(return(expr), restart)
where 34: withOneRestart(expr, restarts[[1L]])
where 35: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 36: 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 37: FUN(X[[i]], ...)
where 38: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 39: force(code)
where 40: doWithOneRestart(return(expr), restart)
where 41: withOneRestart(expr, restarts[[1L]])
where 42: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 43: 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 44: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 45: 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 46: 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 47: test_check("caretEnsemble")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (object, newdata = NULL, ..., verbose = FALSE)
{
if (is.null(newdata)) {
warning("Predicting without new data is not well supported. Attempting to predict on the training data.")
newdata <- object[[1]]$trainingData
if (is.null(newdata)) {
stop("Could not find training data in the first model in the ensemble.")
}
}
if (verbose == TRUE) {
pboptions(type = "txt", char = "*")
}
else if (verbose == FALSE) {
pboptions(type = "none")
}
preds <- pbsapply(object, function(x) {
type <- x$modelType
if (type == "Classification") {
if (x$control$classProbs) {
caret::predict.train(x, type = "prob", newdata = newdata,
...)[, 2]
}
else {
caret::predict.train(x, type = "raw", newdata = newdata,
...)
}
}
else if (type == "Regression") {
caret::predict.train(x, type = "raw", newdata = newdata,
...)
}
else {
stop(paste("Unknown model type:", type))
}
})
if (class(preds) != "matrix" & class(preds) != "data.frame") {
if (class(preds) == "character" | class(preds) == "factor") {
preds <- as.character(preds)
}
preds <- as.matrix(t(preds))
}
colnames(preds) <- make.names(sapply(object, function(x) x$method),
unique = TRUE)
return(preds)
}
<bytecode: 0xcda46f8>
<environment: namespace:caretEnsemble>
--- function search by body ---
Function predict.caretList in namespace caretEnsemble has this body.
----------- END OF FAILURE REPORT --------------
-- 10. Error: We can predict (@test-helper_functions.R#81) --------------------
the condition has length > 1
Backtrace:
1. testthat::expect_warning(...)
7. caretEnsemble:::predict.caretList(...)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
caretEnsemble
--- call from context ---
predict.caretList(models.class, "Classification", newdata = X.class)
--- call from argument ---
if (class(preds) != "matrix" & class(preds) != "data.frame") {
if (class(preds) == "character" | class(preds) == "factor") {
preds <- as.character(preds)
}
preds <- as.matrix(t(preds))
}
--- R stacktrace ---
where 1: predict.caretList(models.class, "Classification", newdata = X.class)
where 2: predict(models.class, "Classification", newdata = X.class)
where 3: eval_bare(expr, quo_get_env(quo))
where 4: quasi_label(enquo(object), label, arg = "object")
where 5: expect_is(predict(models.class, "Classification", newdata = X.class),
"matrix")
where 6: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
where 7: withCallingHandlers(code, warning = function(condition) {
out$push(condition)
maybe_restart("muffleWarning")
})
where 8: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)),
...)
where 9: quasi_capture(enquo(object), label, capture_warnings)
where 10: expect_warning({
expect_is(predict(models.class, "Classification", newdata = X.class),
"matrix")
out1 <- predict(models.class, "Classification", newdata = X.class)
out2 <- predict(models.class, "Classification", verbose = TRUE,
newdata = X.class)
expect_identical(out1, out2)
})
where 11: eval(expr, pf)
where 12: eval(expr, pf)
where 13: withVisible(eval(expr, pf))
where 14: evalVis(expr)
where 15 at testthat/test-helper_functions.R#91: capture.output({
expect_warning({
expect_is(predict(models.class, "Classification", newdata = X.class),
"matrix")
out1 <- predict(models.class, "Classification", newdata = X.class)
out2 <- predict(models.class, "Classification", verbose = TRUE,
newdata = X.class)
expect_identical(out1, out2)
})
expect_warning({
expect_is(predict(models.reg, "Regression", newdata = X.reg),
"matrix")
out1 <- predict(models.reg, "Regression", newdata = X.reg)
out2 <- predict(models.reg, "Regression", verbose = TRUE,
newdata = X.reg)
expect_identical(out1, out2)
})
})
where 16: eval(code, test_env)
where 17: eval(code, test_env)
where 18: 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 19: doTryCatch(return(expr), name, parentenv, handler)
where 20: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 21: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 22: doTryCatch(return(expr), name, parentenv, handler)
where 23: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 24: tryCatchList(expr, classes, parentenv, handlers)
where 25: 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 26: test_code(desc, code, env = parent.frame())
where 27 at testthat/test-helper_functions.R#90: test_that("predict results same regardless of verbose option",
{
sink <- capture.output({
expect_warning({
expect_is(predict(models.class, "Classification",
newdata = X.class), "matrix")
out1 <- predict(models.class, "Classification",
newdata = X.class)
out2 <- predict(models.class, "Classification",
verbose = TRUE, newdata = X.class)
expect_identical(out1, out2)
})
expect_warning({
expect_is(predict(models.reg, "Regression", newdata = X.reg),
"matrix")
out1 <- predict(models.reg, "Regression", newdata = X.reg)
out2 <- predict(models.reg, "Regression", verbose = TRUE,
newdata = X.reg)
expect_identical(out1, out2)
})
})
})
where 28: eval(code, test_env)
where 29: eval(code, test_env)
where 30: 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 31: doTryCatch(return(expr), name, parentenv, handler)
where 32: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 33: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 34: doTryCatch(return(expr), name, parentenv, handler)
where 35: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 36: tryCatchList(expr, classes, parentenv, handlers)
where 37: 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 38: test_code(NULL, exprs, env)
where 39: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 40: force(code)
where 41: doWithOneRestart(return(expr), restart)
where 42: withOneRestart(expr, restarts[[1L]])
where 43: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 44: 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 45: FUN(X[[i]], ...)
where 46: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 47: force(code)
where 48: doWithOneRestart(return(expr), restart)
where 49: withOneRestart(expr, restarts[[1L]])
where 50: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 51: 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 52: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 53: 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 54: 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 55: test_check("caretEnsemble")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (object, newdata = NULL, ..., verbose = FALSE)
{
if (is.null(newdata)) {
warning("Predicting without new data is not well supported. Attempting to predict on the training data.")
newdata <- object[[1]]$trainingData
if (is.null(newdata)) {
stop("Could not find training data in the first model in the ensemble.")
}
}
if (verbose == TRUE) {
pboptions(type = "txt", char = "*")
}
else if (verbose == FALSE) {
pboptions(type = "none")
}
preds <- pbsapply(object, function(x) {
type <- x$modelType
if (type == "Classification") {
if (x$control$classProbs) {
caret::predict.train(x, type = "prob", newdata = newdata,
...)[, 2]
}
else {
caret::predict.train(x, type = "raw", newdata = newdata,
...)
}
}
else if (type == "Regression") {
caret::predict.train(x, type = "raw", newdata = newdata,
...)
}
else {
stop(paste("Unknown model type:", type))
}
})
if (class(preds) != "matrix" & class(preds) != "data.frame") {
if (class(preds) == "character" | class(preds) == "factor") {
preds <- as.character(preds)
}
preds <- as.matrix(t(preds))
}
colnames(preds) <- make.names(sapply(object, function(x) x$method),
unique = TRUE)
return(preds)
}
<bytecode: 0xcda46f8>
<environment: namespace:caretEnsemble>
--- function search by body ---
Function predict.caretList in namespace caretEnsemble has this body.
----------- END OF FAILURE REPORT --------------
-- 11. Error: predict results same regardless of verbose option ---------------
the condition has length > 1
Backtrace:
1. testthat::expect_warning(...)
10. caretEnsemble:::predict.caretList(...)
== testthat results ===========================================================
[ OK: 317 | SKIPPED: 29 | WARNINGS: 3 | FAILED: 11 ]
1. Error: caretList predictions (@test-caretList.R#109)
2. Error: We can stack regression models (@test-caretStack.R#23)
3. Error: We can stack classification models (@test-caretStack.R#36)
4. Error: Failure to calculate se occurs gracefully (@test-caretStack.R#64)
5. Error: We can extract resdiuals from caretEnsemble objects (@test-ensemble.R#43)
6. Error: We can ensemble regression models (@test-ensemble.R#79)
7. Error: It works for regression models (@test-ensemble.R#160)
8. Error: It works for classification models (@test-ensemble.R#176)
9. Error: We can predict (@test-helper_functions.R#63)
1. ...
Error: testthat unit tests failed
Execution halted
Flavor: r-devel-linux-x86_64-debian-clang
Version: 2.0.0
Check: re-building of vignette outputs
Result: WARN
Error(s) in re-building vignettes:
...
--- re-building 'caretEnsemble-intro.Rmd' using rmarkdown
Warning in train.default(x, y, weights = w, ...) :
The metric "Accuracy" was not in the result set. ROC will be used instead.
Warning: glm.fit: algorithm did not converge
Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
Warning: glm.fit: algorithm did not converge
Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
Warning: glm.fit: algorithm did not converge
Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
Warning: glm.fit: algorithm did not converge
Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
Warning: glm.fit: algorithm did not converge
Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
Warning: glm.fit: algorithm did not converge
Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
Warning: glm.fit: algorithm did not converge
Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
Warning: glm.fit: algorithm did not converge
Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
Warning: glm.fit: algorithm did not converge
Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
Warning: glm.fit: algorithm did not converge
Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
Warning: glm.fit: algorithm did not converge
Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
Warning: glm.fit: algorithm did not converge
Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
Warning: glm.fit: algorithm did not converge
Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
Warning: glm.fit: algorithm did not converge
Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
Warning: glm.fit: algorithm did not converge
Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
Warning: glm.fit: algorithm did not converge
Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
Warning: glm.fit: algorithm did not converge
Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
Warning: glm.fit: algorithm did not converge
Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
Warning: glm.fit: algorithm did not converge
Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
Warning: glm.fit: algorithm did not converge
Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
Warning: glm.fit: algorithm did not converge
Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
Warning: glm.fit: algorithm did not converge
Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
Warning: glm.fit: algorithm did not converge
Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
Warning: glm.fit: algorithm did not converge
Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
Warning: glm.fit: algorithm did not converge
Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
Warning: glm.fit: algorithm did not converge
Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
Warning in train.default(x, y, weights = w, ...) :
The metric "Accuracy" was not in the result set. ROC will be used instead.
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
caretEnsemble
--- call from context ---
predict.caretList(model_list, newdata = head(testing))
--- call from argument ---
if (class(preds) != "matrix" & class(preds) != "data.frame") {
if (class(preds) == "character" | class(preds) == "factor") {
preds <- as.character(preds)
}
preds <- as.matrix(t(preds))
}
--- R stacktrace ---
where 1: predict.caretList(model_list, newdata = head(testing))
where 2: predict(model_list, newdata = head(testing))
where 3: as.data.frame(predict(model_list, newdata = head(testing)))
where 4: eval(expr, envir, enclos)
where 5: eval(expr, envir, enclos)
where 6: withVisible(eval(expr, envir, enclos))
where 7: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler,
error = eHandler, message = mHandler)
where 8: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir,
enclos)), warning = wHandler, error = eHandler, message = mHandler))
where 9: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr,
envir, enclos)), warning = wHandler, error = eHandler, message = mHandler)))
where 10: 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 11: evaluate::evaluate(...)
where 12: 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 13: 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 14: block_exec(params)
where 15: call_block(x)
where 16: process_group.block(group)
where 17: process_group(group)
where 18: 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 19: process_file(text, output)
where 20: knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet,
encoding = encoding)
where 21: rmarkdown::render(file, encoding = encoding, quiet = quiet, envir = globalenv(),
...)
where 22: vweave_rmarkdown(...)
where 23: engine$weave(file, quiet = quiet, encoding = enc)
where 24: doTryCatch(return(expr), name, parentenv, handler)
where 25: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 26: tryCatchList(expr, classes, parentenv, handlers)
where 27: 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)
}
outputs <- c(outputs, output)
}, error = function(e) {
thisOK <<- FALSE
fails <<- c(fails, file)
message(gettextf("Error: processing vignette '%s' failed with diagnostics:\n%s",
file, conditionMessage(e)))
})
where 28: tools:::buildVignettes(dir = "/home/hornik/tmp/R.check/r-devel-clang/Work/PKGS/caretEnsemble.Rcheck/vign_test/caretEnsemble",
ser_elibs = "/tmp/RtmpUwDkvO/file3fa23470276a.rds")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (object, newdata = NULL, ..., verbose = FALSE)
{
if (is.null(newdata)) {
warning("Predicting without new data is not well supported. Attempting to predict on the training data.")
newdata <- object[[1]]$trainingData
if (is.null(newdata)) {
stop("Could not find training data in the first model in the ensemble.")
}
}
if (verbose == TRUE) {
pboptions(type = "txt", char = "*")
}
else if (verbose == FALSE) {
pboptions(type = "none")
}
preds <- pbsapply(object, function(x) {
type <- x$modelType
if (type == "Classification") {
if (x$control$classProbs) {
caret::predict.train(x, type = "prob", newdata = newdata,
...)[, 2]
}
else {
caret::predict.train(x, type = "raw", newdata = newdata,
...)
}
}
else if (type == "Regression") {
caret::predict.train(x, type = "raw", newdata = newdata,
...)
}
else {
stop(paste("Unknown model type:", type))
}
})
if (class(preds) != "matrix" & class(preds) != "data.frame") {
if (class(preds) == "character" | class(preds) == "factor") {
preds <- as.character(preds)
}
preds <- as.matrix(t(preds))
}
colnames(preds) <- make.names(sapply(object, function(x) x$method),
unique = TRUE)
return(preds)
}
<bytecode: 0x15381df8>
<environment: namespace:caretEnsemble>
--- function search by body ---
Function predict.caretList in namespace caretEnsemble has this body.
----------- END OF FAILURE REPORT --------------
Quitting from lines 60-62 (caretEnsemble-intro.Rmd)
Error: processing vignette 'caretEnsemble-intro.Rmd' failed with diagnostics:
the condition has length > 1
--- failed re-building 'caretEnsemble-intro.Rmd'
SUMMARY: processing the following file failed:
'caretEnsemble-intro.Rmd'
Error: Vignette re-building failed.
Execution halted
Flavor: r-devel-linux-x86_64-debian-clang