Skip to content

Commit

Permalink
test: improve runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
be-marc committed Sep 14, 2024
1 parent 6afb23d commit 1d66f57
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
18 changes: 10 additions & 8 deletions tests/testthat/test_LearnerClassifAuto.R
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,10 @@ test_that("nnet works", {
test_that("ranger works", {
skip_on_cran()
skip_if_not_installed("rush")
skip_if_not_installed("ranger")
flush_redis()

rush_plan(n_workers = 2)
skip_if_not_installed("ranger")


task = tsk("penguins")
learner = lrn("classif.auto",
learner_ids = "ranger",
Expand Down Expand Up @@ -247,6 +245,7 @@ test_that("extra_trees and glmnet works", {
task = tsk("penguins")
learner = lrn("classif.auto",
learner_ids = c("extra_trees", "glmnet"),
small_data_size = 1,
resampling = rsmp("holdout"),
measure = msr("classif.ce"),
terminator = trm("evals", n_evals = 6)
Expand All @@ -268,6 +267,7 @@ test_that("lightgbm works", {
learner = lrn("classif.auto",
learner_ids = "lightgbm",
lightgbm_eval_metric = "multi_logloss",
small_data_size = 1,
resampling = rsmp("holdout"),
measure = msr("classif.ce"),
terminator = trm("evals", n_evals = 6)
Expand All @@ -291,10 +291,11 @@ test_that("xgboost, catboost and lightgbm work", {
catboost_eval_metric = "MultiClass",
lightgbm_eval_metric = "multi_logloss",
xgboost_eval_metric = "mlogloss",
small_data_size = 1,
resampling = rsmp("holdout"),
lhs_size = 1,
measure = msr("classif.ce"),
terminator = trm("evals", n_evals = 20),
terminator = trm("evals", n_evals = 7),
callbacks = clbk("mlr3tuning.async_save_logs")
)

Expand All @@ -311,10 +312,11 @@ test_that("all learner work", {

task = tsk("penguins")
learner = lrn("classif.auto",
small_data_size = 100,
small_data_size = 1,
lhs_size = 1,
resampling = rsmp("holdout"),
measure = msr("classif.ce"),
terminator = trm("evals", n_evals = 20),
lhs_size = 1
terminator = trm("evals", n_evals = 20)
)

expect_class(learner$train(task), "LearnerClassifAuto")
Expand Down Expand Up @@ -366,7 +368,7 @@ test_that("large data set switch works", {
large_data_size = 100,
large_data_nthread = 4,
large_data_learner_ids = "ranger",
small_data_size = 100,
small_data_size = 1,
measure = msr("classif.ce"),
terminator = trm("evals", n_evals = 1),
lhs_size = 1,
Expand Down
9 changes: 7 additions & 2 deletions tests/testthat/test_LearnerRegrAuto.R
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ test_that("extra_trees and glmnet works", {
task = tsk("mtcars")
learner = lrn("regr.auto",
learner_ids = c("extra_trees", "glmnet"),
small_data_size = 1,
resampling = rsmp("holdout"),
measure = msr("regr.rmse"),
terminator = trm("evals", n_evals = 6)
Expand All @@ -189,6 +190,7 @@ test_that("lightgbm works", {
task = tsk("mtcars")
learner = lrn("regr.auto",
learner_ids = "lightgbm",
small_data_size = 1,
lightgbm_eval_metric = "multi_logloss",
resampling = rsmp("holdout"),
measure = msr("regr.rmse"),
Expand All @@ -206,6 +208,7 @@ test_that("xgboost, catboost and lightgbm work", {
task = tsk("mtcars")
learner = lrn("regr.auto",
learner_ids = c("xgboost", "catboost", "lightgbm"),
small_data_size = 1,
catboost_eval_metric = "MultiClass",
lightgbm_eval_metric = "multi_logloss",
xgboost_eval_metric = "mlogloss",
Expand All @@ -225,7 +228,8 @@ test_that("all learner work", {

task = tsk("mtcars")
learner = lrn("regr.auto",
small_data_size = 100,
small_data_size = 1,
resampling = rsmp("holdout"),
measure = msr("regr.rmse"),
terminator = trm("evals", n_evals = 20),
lhs_size = 1
Expand Down Expand Up @@ -280,7 +284,8 @@ test_that("large data set switch works", {
large_data_size = 100,
large_data_nthread = 4,
large_data_learner_ids = "ranger",
small_data_size = 100,
small_data_size = 1,
resampling = rsmp("holdout"),
measure = msr("regr.rmse"),
terminator = trm("evals", n_evals = 1),
lhs_size = 1,
Expand Down

0 comments on commit 1d66f57

Please sign in to comment.