Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable LightGBM testing on Windows #345

Merged
merged 4 commits into from
Apr 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions man/Lrnr_haldensify.Rd

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

12 changes: 9 additions & 3 deletions tests/testthat/test-lightgbm.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,36 @@ test_learner <- function(learner, task, ...) {
# with only default arguments. Not sure if this is a reasonable requirement
learner_obj <- learner$new(...)
print(sprintf("Testing Learner: %s", learner_obj$name))

# test learner training
fit_obj <- learner_obj$train(task)
test_that("Learner can be trained on data", {
skip_on_os("windows")
fit_obj <- learner_obj$train(task)
expect_true(fit_obj$is_trained)
})

# test learner prediction
train_preds <- fit_obj$predict()
test_that("Learner can generate training set predictions", {
skip_on_os("windows")
fit_obj <- learner_obj$train(task)
train_preds <- fit_obj$predict()
expect_equal(
sl3:::safe_dim(train_preds)[1], length(task$Y)
)
})

# test learner chaining
chained_task <- fit_obj$chain()
test_that("Chaining returns a task", {
skip_on_os("windows")
fit_obj <- learner_obj$train(task)
chained_task <- fit_obj$chain()
expect_true(is(chained_task, "sl3_Task"))
})

test_that("Chaining returns the correct number of rows", {
skip_on_os("windows")
fit_obj <- learner_obj$train(task)
chained_task <- fit_obj$chain()
expect_equal(nrow(chained_task$X), nrow(task$X))
})
}
Expand Down
9 changes: 9 additions & 0 deletions tests/testthat/test-screeners.R
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,16 @@ test_importance_screener <- function(learner) {
}

test_that("Lrnr_screener_importance tests", {
# get all learners supporting variable importance
importance_learners <- sl3::sl3_list_learners("importance")

# remove LightGBM on Windows
if (Sys.info()["sysname"] == "Windows") {
importance_learners <-
importance_learners[!(importance_learners == "Lrnr_lightgbm")]
}

# test all learners supporting variable importance
lapply(importance_learners, test_importance_screener)
})

Expand Down