Skip to content

Commit

Permalink
some more small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Zach Deane-Mayer committed Jun 27, 2024
1 parent fe24b61 commit aba4909
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .coderabbit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ reviews:
enabled: true
drafts: false
chat:
auto_reply: false
auto_reply: false
6 changes: 3 additions & 3 deletions R/caretList.R
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,10 @@ extractCaretTarget.formula <- function(form, data, ...) {
}

#' Create a list of several train models from the caret package
# "
#'
#' Build a list of train objects suitable for ensembling using the \code{\link{caretEnsemble}}
#' function.
# "
#'
#' @param ... arguments to pass to \code{\link{train}}. These arguments will determine which train method gets dispatched.
#' @param trControl a \code{\link{trainControl}} object. We are going to intercept this object check that it has the "index" slot defined, and define the indexes if they are not.
#' @param methodList optional, a character vector of caret models to ensemble. One of methodList or tuneList must be specified.
Expand Down Expand Up @@ -306,7 +306,7 @@ as.caretList.list <- function(object) {

#' @title Create a matrix of predictions for each of the models in a caretList
#' @description Make a matrix of predictions from a list of caret models
# "
#'
#' @param object an object of class caretList
#' @param verbose Logical. If FALSE no progress bar is printed if TRUE a progress
#' bar is shown. Default FALSE.
Expand Down
5 changes: 1 addition & 4 deletions man/caretList.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions tests/testthat/test-a-skip.R

This file was deleted.

6 changes: 3 additions & 3 deletions tests/testthat/test-caretList.R
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ test_that("caretList errors for bad models", {
bad = caretModelSpec(method = "glm", tuneLength = 1)
)
suppressWarnings({
sink <- capture.output({
invisible(capture.output({
expect_error(caretList(iris[, 1:4], iris[, 5], tuneList = bad_bad, trControl = my_control))
expect_error(caretList(iris[, 1:4], iris[, 5], tuneList = good_bad, trControl = my_control))
expect_error(caretList(iris[, 1:4], iris[, 5], tuneList = bad_bad, trControl = my_control, continue_on_fail = TRUE))
working <- caretList(iris[, 1:4], iris[, 5], tuneList = good_bad, trControl = my_control, continue_on_fail = TRUE)
expect_is(working, "caretList")
})
}))
})
})

Expand Down Expand Up @@ -213,7 +213,7 @@ test_that("We can handle different CV methods", {
)
})
})
sink <- sapply(models, expect_is, class = "train")
invisible(sapply(models, expect_is, class = "train"))

suppressWarnings({
suppressMessages({
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-caretStack.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ test_that("We can stack regression models", {
)
expect_that(ens.reg, is_a("caretStack"))
expect_is(summary(ens.reg), "summary.lm")
sink <- capture.output(print(ens.reg))
invisible(capture.output(print(ens.reg)))
suppressWarnings(pred.reg <- predict(ens.reg, newdata = X.reg))
expect_true(is.numeric(pred.reg))
expect_true(length(pred.reg) == 150)
Expand All @@ -35,7 +35,7 @@ test_that("We can stack classification models", {
)
expect_that(ens.class, is_a("caretStack"))
expect_is(summary(ens.class), "summary.glm")
sink <- capture.output(print(ens.class))
invisible(capture.output(print(ens.class)))
suppressWarnings(pred.class <- predict(ens.class, X.class, type = "prob"))
expect_true(is.numeric(pred.class))
expect_true(length(pred.class) == 150)
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-helper_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ test_that("We can predict", {
})

test_that("predict results same regardless of verbose option", {
sink <- capture.output({
invisible(capture.output({
suppressWarnings({
expect_is(predict(models.class, "Classification", newdata = X.class), "matrix")
out1 <- predict(models.class, "Classification", newdata = X.class)
Expand All @@ -97,7 +97,7 @@ test_that("predict results same regardless of verbose option", {
out2 <- predict(models.reg, "Regression", verbose = TRUE, newdata = X.reg)
expect_identical(out1, out2)
})
})
}))
})

context("Test weighted standard deviations")
Expand Down

0 comments on commit aba4909

Please sign in to comment.