diff --git a/NEWS.md b/NEWS.md index dba77a500..aac4a0302 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,6 @@ # mlr3pipelines 0.5.0-9000 +* Changed the ID of `PipeOpFeatureUnion` used in `ppl("robustify")` and `ppl("stacking")` * Feature: The `$add_pipeop()` method got an argument `clone` (old behaviour `TRUE` by default) * Bugfix: `PipeOpFeatureUnion` in some rare cases dropped variables called `"x"` * Compatibility with upcoming paradox release diff --git a/R/pipeline_robustify.R b/R/pipeline_robustify.R index 1d9774627..abb386c4b 100644 --- a/R/pipeline_robustify.R +++ b/R/pipeline_robustify.R @@ -170,7 +170,7 @@ pipeline_robustify = function(task = NULL, learner = NULL, imputing, po("missind", affect_columns = selector_type(c("numeric", "integer", "logical")), type = if (missind_numeric) "numeric" else "factor") )), - if (has_numbers || has_logicals) po("featureunion"), + if (has_numbers || has_logicals) po("featureunion", id = "featureunion_robustify"), if (has_factorials) po("imputeoor") ) diff --git a/R/pipeline_stacking.R b/R/pipeline_stacking.R index cb1512126..4ac1f0a0d 100644 --- a/R/pipeline_stacking.R +++ b/R/pipeline_stacking.R @@ -53,7 +53,7 @@ pipeline_stacking = function(base_learners, super_learner, method = "cv", folds if (use_features) base_learners_cv = c(base_learners_cv, po("nop")) gunion(base_learners_cv, in_place = TRUE) %>>!% - po("featureunion") %>>!% + po("featureunion", id = "featureunion_stacking") %>>!% super_learner } diff --git a/tests/testthat/test_ppl.R b/tests/testthat/test_ppl.R index 948cbbf79..625fab0ce 100644 --- a/tests/testthat/test_ppl.R +++ b/tests/testthat/test_ppl.R @@ -57,3 +57,19 @@ test_that("mlr_pipeops multi-access works", { expect_equal(ppls(), mlr_graphs) }) + +test_that("mlr3book authors don't sleepwalk through life", { + + tasks = tsks(c("breast_cancer", "sonar")) + + + glrn_stack = as_learner(ppl("robustify") %>>% ppl("stacking", + lrns(c("classif.rpart", "classif.debug")), + lrn("classif.log_reg") + )) + glrn_stack$id = "Stack" + + learners = c(glrn_stack) + bmr = benchmark(benchmark_grid(tasks, learners, rsmp("cv", folds = 3))) + +})