diff --git a/inst/testthat/helper_misc.R b/inst/testthat/helper_misc.R index bb50689e..03770bb0 100644 --- a/inst/testthat/helper_misc.R +++ b/inst/testthat/helper_misc.R @@ -131,13 +131,13 @@ LearnerRegrDepParams = R6Class("LearnerRegrDepParams", inherit = LearnerRegr, ) MAKE_GL = function() { - g = Graph$new() - op_ds = PipeOpSubsample$new() - op_lrn = PipeOpLearner$new(lrn("classif.rpart")) + g = mlr3pipelines::Graph$new() + op_ds = mlr3pipelines::PipeOpSubsample$new() + op_lrn = mlr3pipelines::PipeOpLearner$new(lrn("classif.rpart")) g$add_pipeop(op_ds) g$add_pipeop(op_lrn) g$add_edge("subsample", "classif.rpart") - GraphLearner$new(g) + mlr3pipelines::GraphLearner$new(g) } flush_redis = function() { diff --git a/tests/testthat/helper.R b/tests/testthat/helper.R index d36d17f5..2e3a748f 100644 --- a/tests/testthat/helper.R +++ b/tests/testthat/helper.R @@ -1,7 +1,6 @@ library(mlr3) library(checkmate) library(mlr3misc) -library(mlr3pipelines) library(paradox) library(R6) diff --git a/tests/testthat/test_AutoTuner.R b/tests/testthat/test_AutoTuner.R index e9240788..64e9b9ac 100644 --- a/tests/testthat/test_AutoTuner.R +++ b/tests/testthat/test_AutoTuner.R @@ -97,7 +97,6 @@ test_that("AT training does not change learner in instance args", { test_that("AutoTuner works with graphlearner", { skip_if_not_installed("mlr3pipelines") skip_if(packageVersion("mlr3pipelines") < "0.5.3") - requireNamespace("mlr3pipelines") gl = MAKE_GL() task = tsk("iris") @@ -134,7 +133,6 @@ test_that("AutoTuner works with graphlearner", { test_that("Nested resampling works with graphlearner", { skip_if_not_installed("mlr3pipelines", "0.5.3") - requireNamespace("mlr3pipelines") gl = MAKE_GL() task = tsk("iris") @@ -275,7 +273,7 @@ test_that("search space from TuneToken works", { test_that("AutoTuner get_base_learner method works", { skip_if_not_installed("mlr3pipelines", "0.5.3") - requireNamespace("mlr3pipelines") + `%>>%` = mlr3pipelines::`%>>%` # simple learner learner = lrn("classif.rpart", cp = to_tune(1e-04, 1e-1, logscale = TRUE)) @@ -293,7 +291,7 @@ test_that("AutoTuner get_base_learner method works", { expect_equal(at$base_learner(recursive = 0)$id, "classif.rpart") # graph learner - learner = as_learner(pipeline_robustify() %>>% lrn("classif.rpart")) + learner = as_learner(mlr3pipelines::pipeline_robustify() %>>% lrn("classif.rpart")) learner$param_set$values$classif.rpart.cp = to_tune(1e-04, 1e-1, logscale = TRUE) learner$id = "graphlearner.classif.rpart" diff --git a/tests/testthat/test_Tuner.R b/tests/testthat/test_Tuner.R index 6f2970aa..36c71130 100644 --- a/tests/testthat/test_Tuner.R +++ b/tests/testthat/test_Tuner.R @@ -70,7 +70,6 @@ test_that("print method workds", { test_that("Tuner works with graphlearner", { skip_if_not_installed("mlr3pipelines") - requireNamespace("mlr3pipelines") gl = MAKE_GL() task = tsk("iris") @@ -410,6 +409,7 @@ test_that("tag internal tune token manually in primary search space", { test_that("Can only pass internal tune tokens one way", { skip_if_not_installed("mlr3pipelines") + l1 = lrn("classif.debug", early_stopping = TRUE) l1$id = "l1" l2 = l1$clone() @@ -418,7 +418,7 @@ test_that("Can only pass internal tune tokens one way", { l1$param_set$set_values( iter = to_tune(upper = 100, internal = TRUE) ) - l = ppl("branch", list(l1 = l1, l2 = l2)) + l = mlr3pipelines::ppl("branch", list(l1 = l1, l2 = l2)) l = as_learner(l) set_validate(l, 0.2, ids = c("l1", "l2")) diff --git a/tests/testthat/test_TuningInstanceBatchSingleCrit.R b/tests/testthat/test_TuningInstanceBatchSingleCrit.R index 432458e7..dfebc633 100644 --- a/tests/testthat/test_TuningInstanceBatchSingleCrit.R +++ b/tests/testthat/test_TuningInstanceBatchSingleCrit.R @@ -109,10 +109,7 @@ test_that("tuning with custom resampling", { test_that("non-scalar hyperpars (#201)", { skip_if_not_installed("mlr3pipelines") - - requireNamespace("mlr3pipelines") - `%>>%` = getFromNamespace("%>>%", asNamespace("mlr3pipelines")) - + `%>>%` = mlr3pipelines::`%>>%` learner = mlr3pipelines::po("select") %>>% lrn("classif.rpart")