Skip to content

Commit

Permalink
solve some of the CRAN issues
Browse files Browse the repository at this point in the history
  • Loading branch information
HannaMeyer committed Apr 17, 2024
1 parent e39623d commit 755e0cc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions tests/testthat/test-errorProfiles.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ test_that("errorProfiles works in default settings", {
model <- caret::train(splotdata[,6:16], splotdata$Species_richness, ntree = 10,
trControl = caret::trainControl(method = "cv", savePredictions = TRUE))

AOA <- CAST::aoa(predictors, model)
AOA <- CAST::aoa(predictors, model,verbose=F)

# DI ~ error
errormodel_DI <- CAST::errorProfiles(model, AOA, variable = "DI")
Expand Down Expand Up @@ -37,7 +37,7 @@ test_that("errorProfiles works in with LPD", {
model <- caret::train(splotdata[,6:16], splotdata$Species_richness, ntree = 10,
trControl = caret::trainControl(method = "cv", savePredictions = TRUE))

AOA <- CAST::aoa(predictors, model, LPD = TRUE, maxLPD = 1)
AOA <- CAST::aoa(predictors, model, LPD = TRUE, maxLPD = 1,verbose=F)
errormodel_LPD <- CAST::errorProfiles(model, AOA, variable = "LPD")
expected_error_LPD = terra::predict(AOA$LPD, errormodel_LPD)

Expand All @@ -64,7 +64,7 @@ test_that("errorProfiles works for multiCV", {
model <- caret::train(splotdata[,6:16], splotdata$Species_richness, ntree = 10,
trControl = caret::trainControl(method = "cv", savePredictions = TRUE))

AOA <- CAST::aoa(predictors, model)
AOA <- CAST::aoa(predictors, model,verbose=F)
# with multiCV = TRUE (for DI ~ error)
set.seed(100)
errormodel_DI = suppressWarnings(errorProfiles(model, AOA, multiCV = TRUE, length.out = 3))
Expand Down
5 changes: 3 additions & 2 deletions tests/testthat/test-fss.R
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ test_that("ffs works with default arguments and the iris dataset",{
seed = 1)

expect_identical(selection$selectedvars, c("Petal.Length", "Petal.Width", "Sepal.Width"))
expect_equal(selection$selectedvars_perf, c(0.9530141, 0.9544820, 0.9544820))
expect_equal(selection$selectedvars_perf, c(0.9530141, 0.9544820, 0.9544820),
tolerance = 0.005)

})

Expand Down Expand Up @@ -128,7 +129,7 @@ test_that("ffs works with withinSE = TRUE", {


expect_identical(selection$selectedvars, c("Petal.Length", "Petal.Width"))
expect_equal(selection$selectedvars_perf, c(0.9530141), tolerance = 0.0005)
expect_equal(selection$selectedvars_perf, c(0.9530141), tolerance = 0.005)

})

Expand Down

0 comments on commit 755e0cc

Please sign in to comment.