Nothing
context("Main Cross-Validation Method")
# test error handling for failed folds
cv_sometimes_errors <- function(fold) {
index <- fold_index()
if (index == 7) {
stop("7 makes me sad")
}
return(list(a = "certainly not 7"))
}
folds <- make_folds(1000)
results <- cross_validate(cv_sometimes_errors, folds)
test_that("Errors are put in special error vector", {
expect_length(results$errors$error, 1)
})
# test error handling when all folds fail
cv_always_errors <- function(fold) {
stop("I always produce an error")
}
folds <- make_folds(1000)
suppressWarnings({
results <- cross_validate(cv_always_errors, folds)
})
test_that("cross_validate handles the case where all folds produce an error", {
expect_equal(names(results), "errors")
})
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.