From 44ec30135c9ee0b4c90a87301114339b3b367ae3 Mon Sep 17 00:00:00 2001 From: mb706 Date: Tue, 12 Aug 2025 14:40:05 +0200 Subject: [PATCH 01/31] progress --- .lintr | 5 +- R/GraphLearner.R | 29 ++-------- R/PipeOp.R | 143 ++++++++++++---------------------------------- R/PipeOpLearner.R | 2 +- R/PipeOpPCA.R | 2 +- 5 files changed, 46 insertions(+), 135 deletions(-) diff --git a/.lintr b/.lintr index f04ed34c6..0daab4746 100644 --- a/.lintr +++ b/.lintr @@ -3,8 +3,7 @@ linters: linters_with_defaults( # the following setup changes/removes certain linters assignment_linter = NULL, # do not force using <- for assignments object_name_linter = object_name_linter(c("snake_case", "CamelCase")), # only allow snake case and camel case object names - cyclocomp_linter = NULL, # do not check function complexity commented_code_linter = NULL, # allow code in comments - line_length_linter = line_length_linter(180L) + line_length_linter = line_length_linter(180L), + indentation_linter = indentation_linter(indent = 2, hanging_indent_style = "never") ) - diff --git a/R/GraphLearner.R b/R/GraphLearner.R index 0fa72cad6..4e5a86952 100644 --- a/R/GraphLearner.R +++ b/R/GraphLearner.R @@ -180,7 +180,7 @@ GraphLearner = R6Class("GraphLearner", inherit = Learner, public = list( impute_selected_features = FALSE, - initialize = function(graph, id = NULL, param_vals = list(), task_type = NULL, predict_type = NULL, clone_graph = TRUE) { + initialize = function(graph, id = NULL, task_type = NULL, predict_type = NULL, clone_graph = TRUE) { graph = as_graph(graph, clone = assert_flag(clone_graph)) graph$state = NULL @@ -216,18 +216,16 @@ GraphLearner = R6Class("GraphLearner", inherit = Learner, intersect(c("importance", "oob_error", "loglik"), blproperties) ) - super$initialize(id = id, task_type = task_type, + super$initialize(id = id, dict_entry = NULL, task_type = task_type, + param_set = alist(private$.graph$param_set), feature_types = mlr_reflections$task_feature_types, predict_types = names(mlr_reflections$learner_predict_types[[task_type]]), packages = graph$packages, - properties = properties, - man = "mlr3pipelines::GraphLearner" + properties = properties ) - if (length(param_vals)) { - private$.graph$param_set$values = insert_named(private$.graph$param_set$values, param_vals) - } if (!is.null(predict_type)) self$predict_type = predict_type + }, base_learner = function(recursive = Inf, return_po = FALSE, return_all = FALSE, resolve_branching = TRUE) { assert(check_numeric(recursive, lower = Inf), check_int(recursive)) @@ -393,12 +391,6 @@ GraphLearner = R6Class("GraphLearner", inherit = Learner, } private$.graph$edges }, - param_set = function(rhs) { - if (!missing(rhs) && !identical(rhs, self$graph$param_set)) { - stop("param_set is read-only.") - } - self$graph$param_set - }, pipeops_param_set = function(rhs) { value = map(self$graph$pipeops, "param_set") if (!missing(rhs) && !identical(value, rhs)) { @@ -434,16 +426,6 @@ GraphLearner = R6Class("GraphLearner", inherit = Learner, if (!length(ivs)) return(named_list()) ivs }, - deep_clone = function(name, value) { - # FIXME this repairs the mlr3::Learner deep_clone() method which is broken. - if (is.environment(value) && !is.null(value[[".__enclos_env__"]])) { - return(value$clone(deep = TRUE)) - } - if (name == "state") { - value$log = copy(value$log) - } - value - }, .train = function(task) { if (!is.null(get0("validate", self))) { @@ -604,7 +586,6 @@ as_learner.PipeOp = function(x, clone = FALSE, ...) { as_learner(as_graph(x, clone = FALSE, ...), clone = clone) } - infer_task_type = function(graph) { output = graph$output # check the high level input and output diff --git a/R/PipeOp.R b/R/PipeOp.R index 8cbc111ab..b086260ad 100644 --- a/R/PipeOp.R +++ b/R/PipeOp.R @@ -249,30 +249,51 @@ #' @template seealso_pipeopslist #' @export PipeOp = R6Class("PipeOp", + inherit = Mlr3Component, public = list( - packages = NULL, state = NULL, input = NULL, output = NULL, .result = NULL, tags = NULL, - properties = NULL, - initialize = function(id, param_set = ps(), param_vals = list(), input, output, packages = character(0), tags = "abstract", properties = character(0)) { - if (inherits(param_set, "ParamSet")) { - private$.param_set = assert_param_set(param_set) - private$.param_set_source = NULL - } else { - lapply(param_set, function(x) assert_param_set(eval(x))) - private$.param_set_source = param_set + initialize = function(id, param_set = ps(), param_vals = list(), input, output, packages = character(0), tags = "abstract", properties = character(0), dict_entry = id) { + + + ## ------ deprecating id and param_vals + sc = sys.calls() + found = 0 + for (i in rev(seq_along(sc))) { + if (identical(sc[[i]], quote(initialize(...)))) { + found = i + break + } } - self$id = assert_string(id, min.chars = 1) + if (found > 0) { + sf = sys.frames()[[found - 1]] + if (identical(class(self), sf$classes)) { + newcall = match.call(sys.function(found), sc[[found]], envir = sf) + passes_param_vals = !is.null(newcall$param_vals) + dots = evalq(list(...), envir = sf) + unnamed_dots = dots[is.na(names2(dots))] + passes_id = length(unnamed_dots) && !is.null(newcall$id) && identical(newcall$id, unnamed_dots[[1]]) + if (passes_param_vals || passes_id) { + warning("passing param_vals, and unnamed id, for PipeOp construction directly is deprecated and will be removed in the future. +Use the po()-syntax to set these, instead: +po(\"pipeop\", \"newid\", param_vals = list(a = 1)) --> po(\"pipeop\", id = \"newid\", a = 1)") + } + } + } + ## ------ + + super$initialize(id = id, dict_entry = dict_entry, dict_shortaccess = "po", + param_set = param_set, packages = packages, properties = properties + ) - self$properties = assert_subset(properties, mlr_reflections$pipeops$properties) + assert_subset(properties, mlr_reflections$pipeops$properties) self$param_set$values = insert_named(self$param_set$values, param_vals) self$input = assert_connection_table(input) self$output = assert_connection_table(output) - self$packages = union("mlr3pipelines", assert_character(packages, any.missing = FALSE, min.chars = 1L)) self$tags = assert_subset(tags, mlr_reflections$pipeops$valid_tags) }, @@ -377,111 +398,21 @@ PipeOp = R6Class("PipeOp", ), active = list( - id = function(val) { - if (!missing(val)) { - private$.id = val - } - private$.id - }, - param_set = function(val) { - if (is.null(private$.param_set)) { - sourcelist = lapply(private$.param_set_source, function(x) eval(x)) - if (length(sourcelist) > 1) { - private$.param_set = ParamSetCollection$new(sourcelist) - } else { - private$.param_set = sourcelist[[1]] - } - } - if (!missing(val) && !identical(val, private$.param_set)) { - stop("param_set is read-only.") - } - private$.param_set - }, predict_type = function(val) { if (!missing(val)) { stop("$predict_type is read-only.") } - return(NULL) + NULL }, innum = function() nrow(self$input), outnum = function() nrow(self$output), - is_trained = function() !is.null(self$state), - hash = function() { - digest(list(class(self), self$id, lapply(self$param_set$values, function(val) { - # ideally we would just want to hash `param_set$values`, but one of the values - # could be an R6 object with a `$hash` slot as well, in which case we take that - # slot's value. This is to avoid different hashes from essentially the same - # objects. - # In the following we also avoid accessing `val$hash` twice, because it could - # potentially be an expensive AB. - if (is.environment(val) && !is.null({vhash = get0("hash", val, mode = "any", inherits = FALSE, ifnotfound = NULL)})) { - vhash - } else { - val - } - }), private$.additional_phash_input()), algo = "xxhash64") - }, - phash = function() { - digest(list(class(self), self$id, private$.additional_phash_input()), algo = "xxhash64") - }, - man = function(x) { - if (!missing(x)) stop("man is read-only") - paste0(topenv(self$.__enclos_env__)$.__NAMESPACE__.$spec[["name"]], "::", class(self)[[1]]) - }, - label = function(x) { - if (!missing(x)) stop("label is read-only") - if (is.null(private$.label)) { - helpinfo = self$help() - helpcontent = NULL - if (inherits(helpinfo, "help_files_with_topic") && length(helpinfo)) { - ghf = get(".getHelpFile", mode = "function", envir = getNamespace("utils")) - helpcontent = ghf(helpinfo) - } else if (inherits(helpinfo, "dev_topic")) { - helpcontent = tools::parse_Rd(helpinfo$path) - } - if (is.null(helpcontent)) { - private$.label = "LABEL COULD NOT BE RETRIEVED" - } else { - private$.label = Filter(function(x) identical(attr(x, "Rd_tag"), "\\title"), helpcontent)[[1]][[1]][1] - } - } - private$.label - } + is_trained = function() !is.null(self$state) ), private = list( .state_class = NULL, - deep_clone = function(name, value) { - if (!is.null(private$.param_set_source)) { - private$.param_set = NULL # required to keep clone identical to original, otherwise tests get really ugly - if (name == ".param_set_source") { - value = lapply(value, function(x) { - if (inherits(x, "R6")) x$clone(deep = TRUE) else x - }) - } - } - if (is.environment(value) && !is.null(value[[".__enclos_env__"]])) { - return(value$clone(deep = TRUE)) - } - value - }, .train = function(input) stop("abstract"), - .predict = function(input) stop("abstract"), - .additional_phash_input = function() { - if (is.null(self$initialize)) return(NULL) - initformals <- names(formals(args(self$initialize))) - if (!test_subset(initformals, c("id", "param_vals"))) { - warningf("PipeOp %s has construction arguments besides 'id' and 'param_vals' but does not overload the private '.additional_phash_input()' function. - -The hash and phash of a PipeOp must differ when it represents a different operation; since %s has construction arguments that could change the operation that is performed by it, it is necessary for the $hash and $phash to reflect this. `.additional_phash_input()` should return all the information (e.g. hashes of encapsulated items) that should additionally be hashed; read the help of ?PipeOp for more information. - -This warning will become an error in the future.", class(self)[[1]], class(self)[[1]]) - } - }, - .param_set = NULL, - .param_set_source = NULL, - .label = NULL, - .id = NULL + .predict = function(input) stop("abstract") ) ) @@ -511,7 +442,7 @@ check_types = function(self, data, direction, operation) { description = sprintf("%s of PipeOp %s's $%s()", direction, self$id, operation) if (direction == "input" && "..." %in% typetable$name) { assert_list(data, min.len = nrow(typetable) - 1, .var.name = description) - typetable = typetable[rep(1:.N, ifelse(get("name") == "...", length(data) - nrow(typetable) + 1, 1))] + typetable = typetable[rep(seq_len(.N), ifelse(get("name") == "...", length(data) - nrow(typetable) + 1, 1))] } else { assert_list(data, len = nrow(typetable), .var.name = description) } diff --git a/R/PipeOpLearner.R b/R/PipeOpLearner.R index 972eb12d5..6cafc10ae 100644 --- a/R/PipeOpLearner.R +++ b/R/PipeOpLearner.R @@ -108,7 +108,7 @@ PipeOpLearner = R6Class("PipeOpLearner", inherit = PipeOp, out_type = mlr_reflections$task_types[type, mult = "first"]$prediction properties = c("validation", "internal_tuning") properties = properties[properties %in% private$.learner$properties] - super$initialize(id, param_set = alist(private$.learner$param_set), param_vals = param_vals, + super$initialize(id = "learner", param_set = alist(private$.learner$param_set), param_vals = param_vals, input = data.table(name = "input", train = task_type, predict = task_type), output = data.table(name = "output", train = "NULL", predict = out_type), tags = "learner", packages = learner$packages, properties = properties diff --git a/R/PipeOpPCA.R b/R/PipeOpPCA.R index 77011e7f0..0080b9185 100644 --- a/R/PipeOpPCA.R +++ b/R/PipeOpPCA.R @@ -76,7 +76,7 @@ PipeOpPCA = R6Class("PipeOpPCA", scale. = p_lgl(default = FALSE, tags = c("train", "pca")), rank. = p_int(default = NULL, lower = 1, upper = Inf, special_vals = list(NULL), tags = c("train", "pca")) ) - super$initialize(id, param_set = ps, param_vals = param_vals, feature_types = c("numeric", "integer")) + super$initialize(id = "pca", param_set = ps, param_vals = param_vals, feature_types = c("numeric", "integer")) } ), private = list( From ffa84eb2fbb67b12b527f309dc56dda825a3b57f Mon Sep 17 00:00:00 2001 From: mb706 Date: Wed, 13 Aug 2025 22:28:45 +0200 Subject: [PATCH 02/31] using po() syntax in tests I --- DESCRIPTION | 3 ++ R/TaskRegr_boston_housing.R | 7 ++-- tests/testthat/test_pipeop_adas.R | 4 +-- tests/testthat/test_pipeop_blsmote.R | 4 +-- tests/testthat/test_pipeop_colroles.R | 14 ++++---- tests/testthat/test_pipeop_datefeatures.R | 16 ++++----- tests/testthat/test_pipeop_learnercv.R | 12 +++---- tests/testthat/test_pipeop_modelmatrix.R | 12 +++---- .../testthat/test_pipeop_multiplicityexply.R | 4 +-- .../testthat/test_pipeop_multiplicityimply.R | 14 ++++---- tests/testthat/test_pipeop_mutate.R | 2 +- tests/testthat/test_pipeop_nearmiss.R | 2 +- tests/testthat/test_pipeop_ovr.R | 14 ++++---- tests/testthat/test_pipeop_pca.R | 4 +-- tests/testthat/test_pipeop_proxy.R | 34 +++++++++---------- tests/testthat/test_pipeop_quantilebin.R | 4 +-- tests/testthat/test_pipeop_randomprojection.R | 4 +-- tests/testthat/test_pipeop_randomresponse.R | 12 +++---- tests/testthat/test_pipeop_removeconstants.R | 4 +-- tests/testthat/test_pipeop_renamecolumns.R | 6 ++-- tests/testthat/test_pipeop_replicate.R | 4 +-- tests/testthat/test_pipeop_rowapply.R | 16 ++++----- tests/testthat/test_pipeop_scale.R | 4 +-- tests/testthat/test_pipeop_scalemaxabs.R | 4 +-- tests/testthat/test_pipeop_scalerange.R | 4 +-- tests/testthat/test_pipeop_select.R | 4 +-- tests/testthat/test_pipeop_smote.R | 6 ++-- tests/testthat/test_pipeop_smotenc.R | 2 +- tests/testthat/test_pipeop_spatialsign.R | 10 +++--- tests/testthat/test_pipeop_subsample.R | 22 ++++++------ tests/testthat/test_pipeop_targetinvert.R | 2 +- tests/testthat/test_pipeop_targetmutate.R | 4 +-- .../test_pipeop_targettrafoscalerange.R | 10 +++--- tests/testthat/test_pipeop_textvectorizer.R | 22 ++++++------ tests/testthat/test_pipeop_threshold.R | 12 +++---- tests/testthat/test_pipeop_tomek.R | 2 +- tests/testthat/test_pipeop_unbranch.R | 10 +++--- tests/testthat/test_pipeop_vtreat.R | 12 +++---- tests/testthat/test_pipeop_yeojohnson.R | 6 ++-- tests/testthat/test_preproc.R | 2 +- tests/testthat/test_resample.R | 4 +-- tests/testthat/test_typecheck.R | 20 +++++------ tests/testthat/test_usecases.R | 26 +++++++------- 43 files changed, 193 insertions(+), 191 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index ebd01913c..6366b5caf 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -102,6 +102,9 @@ Suggests: htmlwidgets, ranger, themis +Remotes: + mlr-org/mlr3misc@common_baseclass, + mlr-org/mlr3@common_baseclass ByteCompile: true Encoding: UTF-8 Config/testthat/edition: 3 diff --git a/R/TaskRegr_boston_housing.R b/R/TaskRegr_boston_housing.R index b0a13b3e5..3c98e3b9c 100644 --- a/R/TaskRegr_boston_housing.R +++ b/R/TaskRegr_boston_housing.R @@ -4,7 +4,7 @@ #' @name mlr_tasks_boston_housing #' @format [`R6Class`][R6::R6Class] object inheriting from [`TaskRegr`][mlr3::TaskRegr]. #' -#' The [`BostonHousing2`][mlbench::BostonHousing2] dataset +#' The [`BostonHousing2`][mlbench::BostonHousing2] dataset #' containing the corrected data from `r format_bib("freeman_1979")` #' as provided by the `mlbench` package. See data description there. #' @@ -13,9 +13,8 @@ NULL load_boston_housing = function(id = "boston_housing") { bh = mlr3misc::load_dataset("BostonHousing2", "mlbench") bh$medv = NULL - bht = as_task_regr(bh, target = "cmedv", id = id, label = "Boston Housing Prices") - bht$man = "mlr3pipelines::mlr_tasks_boston_housing" - bht$backend$hash = "mlr3::mlr_tasks_boston_housing" + bht = as_task_regr(bh, target = "cmedv", id = id) + bht$override_info(man = "mlr3pipelines::mlr_tasks_boston_housing", hash = "mlr3::mlr_tasks_boston_housing") bht } diff --git a/tests/testthat/test_pipeop_adas.R b/tests/testthat/test_pipeop_adas.R index 438c670c9..3d1c2809a 100644 --- a/tests/testthat/test_pipeop_adas.R +++ b/tests/testthat/test_pipeop_adas.R @@ -11,7 +11,7 @@ test_that("PipeOpADAS - basic properties", { test_that("PipeOpADAS - train works as intended", { skip_if_not_installed("smotefamily") - op = PipeOpADAS$new() + op = po("adas") set.seed(1234L) df = data.frame( @@ -59,7 +59,7 @@ test_that("PipeOpADAS - train works as intended", { test_that("PipeOpADAS - handling of feature named 'class'", { skip_if_not_installed("smotefamily") - op = PipeOpADAS$new() + op = po("adas") set.seed(1234L) df = data.frame( diff --git a/tests/testthat/test_pipeop_blsmote.R b/tests/testthat/test_pipeop_blsmote.R index a29a5a093..fde20c6ba 100644 --- a/tests/testthat/test_pipeop_blsmote.R +++ b/tests/testthat/test_pipeop_blsmote.R @@ -11,7 +11,7 @@ test_that("PipeOpBLSmote - basic properties", { test_that("PipeOpBLSmote - train works as intended", { skip_if_not_installed("smotefamily") - op = PipeOpBLSmote$new() + op = po("blsmote") set.seed(1234) df = smotefamily::sample_generator(500, 0.8) @@ -74,7 +74,7 @@ test_that("PipeOpBLSmote - train works as intended", { test_that("PipeOpBLSmote - handling of feature named 'class'", { skip_if_not_installed("smotefamily") - op = PipeOpBLSmote$new() + op = po("blsmote") set.seed(1234) df = smotefamily::sample_generator(500, 0.8) diff --git a/tests/testthat/test_pipeop_colroles.R b/tests/testthat/test_pipeop_colroles.R index 68bca738b..11cf99bfd 100644 --- a/tests/testthat/test_pipeop_colroles.R +++ b/tests/testthat/test_pipeop_colroles.R @@ -1,7 +1,7 @@ context("PipeOpColRoles") test_that("PipeOpColRoles - basic properties", { - op = PipeOpColRoles$new() + op = po("colroles") task = mlr_tasks$get("iris") expect_datapreproc_pipeop_class(PipeOpColRoles, task = task) }) @@ -37,10 +37,10 @@ test_that("PipeOpColRoles - only existing columns are accepted", { task = mlr_tasks$get("iris") task$cbind(data.table(rn = sprintf("%03d", 1:150))) - op = PipeOpColRoles$new(param_vals = list(new_role = list(rn = "name", wrong = "feature"))) + op = po("colroles", new_role = list(rn = "name", wrong = "feature")) expect_error(train_pipeop(op, inputs = list(task)), regexp = "subset") - op = PipeOpColRoles$new(param_vals = list(new_role_direct = list(name = "rn", feature = "wrong"))) + op = po("colroles", new_role_direct = list(name = "rn", feature = "wrong")) expect_error(train_pipeop(op, inputs = list(task)), regexp = "subset") }) @@ -49,10 +49,10 @@ test_that("PipeOpColRoles - changing the role of a target fails", { task = mlr_tasks$get("iris") - op = PipeOpColRoles$new(param_vals = list(new_role = list(Species = "feature"))) + op = po("colroles", new_role = list(Species = "feature")) expect_error(train_pipeop(op, inputs = list(task)), regexp = "role of a target") - op = PipeOpColRoles$new(param_vals = list(new_role_direct = list(feature = "Species"))) + op = po("colroles", new_role_direct = list(feature = "Species")) expect_error(train_pipeop(op, inputs = list(task)), regexp = "role of a target") }) @@ -62,7 +62,7 @@ test_that("PipeOpColRoles - new_role works", { task = mlr_tasks$get("iris") task$cbind(data.table(rn = sprintf("%03d", 1:150))) - op = PipeOpColRoles$new(param_vals = list(new_role = list( + op = po("colroles", new_role = list( rn = "name", Petal.Length = c("feature", "order"), Petal.Width = character(0), Sepal.Width = NULL)) ) @@ -92,7 +92,7 @@ test_that("PipeOpColRoles - new_role_direct works", { task$cbind(data.table(rn = sprintf("%03d", 1:150))) task$col_roles$group = "Species" - op = PipeOpColRoles$new(param_vals = list(new_role_direct = list( + op = po("colroles", new_role_direct = list( name = "rn", order = c("Petal.Length", "Sepal.Length"), feature = character(0), group = NULL)) ) diff --git a/tests/testthat/test_pipeop_datefeatures.R b/tests/testthat/test_pipeop_datefeatures.R index 6d19c4158..72a5d6382 100644 --- a/tests/testthat/test_pipeop_datefeatures.R +++ b/tests/testthat/test_pipeop_datefeatures.R @@ -6,7 +6,7 @@ test_that("PipeOpDateFeatures - basic properties", { dat$date = sample(seq(as.POSIXct("2020-01-31"), to = as.POSIXct("2020-03-01"), by = "sec"), size = 150L) task = TaskClassif$new("iris_date", backend = dat, target = "Species") - po = PipeOpDateFeatures$new() + po = po("datefeatures") expect_datapreproc_pipeop_class(PipeOpDateFeatures, task = task) }) @@ -16,7 +16,7 @@ test_that("PipeOpDateFeatures - finds POSIXct column", { dat$date = sample(seq(as.POSIXct("2020-01-31"), to = as.POSIXct("2020-03-01"), by = "sec"), size = 150L) task = TaskClassif$new("iris_date", backend = dat, target = "Species") - po = PipeOpDateFeatures$new() + po = po("datefeatures") train_pipeop(po, inputs = list(task)) }) @@ -37,7 +37,7 @@ test_that("PipeOpDateFeatures - unaltered if no features specified", { dat$date = sample(seq(as.POSIXct("2020-01-31"), to = as.POSIXct("2020-03-01"), by = "sec"), size = 150L) task = TaskClassif$new("iris_date", backend = dat, target = "Species") - po = PipeOpDateFeatures$new(param_vals = list(cyclic = TRUE, year = FALSE, + po = po("datefeatures", cyclic = TRUE, year = FALSE, month = FALSE, week_of_year = FALSE, day_of_year = FALSE, day_of_month = FALSE, day_of_week = FALSE, hour = FALSE, minute = FALSE, second = FALSE, is_day = FALSE)) train_pipeop(po, inputs = list(task)) @@ -50,7 +50,7 @@ test_that("PipeOpDateFeatures - correct basic features", { dat$date = sample(seq(as.POSIXct("2020-01-31"), to = as.POSIXct("2020-03-01"), by = "sec"), size = 150L) task = TaskClassif$new("iris_date", backend = dat, target = "Species") - po = PipeOpDateFeatures$new() + po = po("datefeatures") trained_data = train_pipeop(po, inputs = list(task))$output$data() expect_true(all(trained_data$date.year == as.numeric(format(dat$date, "%Y")))) expect_true(all(trained_data$date.month == as.numeric(format(dat$date, "%m")))) @@ -71,7 +71,7 @@ test_that("PipeOpDateFeatures - correct cyclic features", { dat$date = sample(seq(as.POSIXct("2020-02-01"), to = as.POSIXct("2020-02-29"), by = "sec"), size = 150L) task = TaskClassif$new("iris_date", backend = dat, target = "Species") - po = PipeOpDateFeatures$new(param_vals = list(cyclic = TRUE)) + po = po("datefeatures", cyclic = TRUE) trained_data = train_pipeop(po, inputs = list(task))$output$data() month = as.numeric(format(dat$date, "%m")) - 1L @@ -146,7 +146,7 @@ test_that("PipeOpDateFeatures - automatic NA handling", { size = 150L) dat$date[1L] = NA task = TaskClassif$new("iris_date", backend = dat, target = "Species") - po = PipeOpDateFeatures$new(param_vals = list(cyclic = TRUE)) + po = po("datefeatures", cyclic = TRUE) output = train_pipeop(po, inputs = list(task))$output expect_true(all(is.na(output$data(rows = 1L, cols = output$feature_names[- (1L:4L)])))) }) @@ -166,7 +166,7 @@ test_that("PipeOpDateFeatures - no year but day_of_year and day_of_month", { dat$date = sample(seq(as.POSIXct("2020-01-31"), to = as.POSIXct("2020-03-01"), by = "sec"), size = 150L) task = TaskClassif$new("iris_date", backend = dat, target = "Species") - po = PipeOpDateFeatures$new(param_vals = list(cyclic = TRUE, year = FALSE)) + po = po("datefeatures", cyclic = TRUE, year = FALSE) expect_true("date.year" %nin% train_pipeop(po, inputs = list(task))$output$feature_names) }) @@ -176,7 +176,7 @@ test_that("PipeOpDateFeatures - only year and cyclic", { dat$date = sample(seq(as.POSIXct("2020-01-31"), to = as.POSIXct("2020-03-01"), by = "sec"), size = 150L) task = TaskClassif$new("iris_date", backend = dat, target = "Species") - po = PipeOpDateFeatures$new() + po = po("datefeatures") po$param_set$values$month = TRUE po$param_set$values$month = FALSE po$param_set$values$week_of_year = FALSE diff --git a/tests/testthat/test_pipeop_learnercv.R b/tests/testthat/test_pipeop_learnercv.R index 9d6069f65..d30fd3e53 100644 --- a/tests/testthat/test_pipeop_learnercv.R +++ b/tests/testthat/test_pipeop_learnercv.R @@ -2,7 +2,7 @@ context("PipeOpLearnerCV") test_that("PipeOpLearnerCV - basic properties", { lrn = mlr_learners$get("classif.featureless") - po = PipeOpLearnerCV$new(lrn) + po = po("learner_cv", lrn) expect_pipeop(po$clone(), check_ps_default_values = FALSE) expect_data_table(po$input, nrows = 1) expect_data_table(po$output, nrows = 1) @@ -41,7 +41,7 @@ test_that("PipeOpLearnerCV - basic properties", { test_that("PipeOpLearnerCV - param values", { skip_if_not_installed("rpart") lrn = mlr_learners$get("classif.rpart") - polrn = PipeOpLearnerCV$new(lrn) + polrn = po("learner_cv", lrn) expect_subset(c("minsplit", "resampling.method", "resampling.folds"), polrn$param_set$ids()) expect_equal(polrn$param_set$values, list(resampling.method = "cv", resampling.folds = 3, resampling.keep_response = FALSE, xval = 0)) polrn$param_set$values$minsplit = 2 @@ -53,7 +53,7 @@ test_that("PipeOpLearnerCV - param values", { test_that("PipeOpLearnerCV - within resampling", { skip_if_not_installed("rpart") lrn = mlr_learners$get("classif.rpart") - gr = GraphLearner$new(PipeOpLearnerCV$new(lrn) %>>% po(id = "l2", lrn)) + gr = GraphLearner$new(po("learner_cv", lrn) %>>% po(id = "l2", lrn)) rr = resample(tsk("iris"), gr, rsmp("holdout")) expect_class(rr, "ResampleResult") }) @@ -63,13 +63,13 @@ test_that("PipeOpLearnerCV - insample resampling", { lrn = mlr_learners$get("classif.featureless") iris_with_unambiguous_mode = mlr_tasks$get("iris")$filter(c(1:30, 70:150)) # want featureless learner without randomness - polrn = PipeOpLearnerCV$new(lrn, param_vals = list(resampling.method = "insample")) + polrn = po("learner_cv", lrn, resampling.method = "insample") expect_equal(polrn$train(list(iris_with_unambiguous_mode))[[1]]$data(), cbind(iris_with_unambiguous_mode$data(cols = "Species"), classif.featureless.response = factor("virginica", levels = levels(iris[[5]])))) lrn = mlr_learners$get("classif.rpart") - polrn = PipeOpLearnerCV$new(lrn, param_vals = list(resampling.method = "insample")) + polrn = po("learner_cv", lrn, resampling.method = "insample") expect_equal(polrn$train(list(iris_with_unambiguous_mode))[[1]], polrn$predict(list(iris_with_unambiguous_mode))[[1]]) }) @@ -83,7 +83,7 @@ test_that("PipeOpLearnerCV - graph but no id", { test_that("PipeOpLearnerCV - model active binding to state", { lrn = mlr_learners$get("classif.featureless") - po = PipeOpLearnerCV$new(lrn) + po = po("learner_cv", lrn) task = mlr_tasks$get("iris") # before training states are NULL diff --git a/tests/testthat/test_pipeop_modelmatrix.R b/tests/testthat/test_pipeop_modelmatrix.R index 3bf978918..5438fce24 100644 --- a/tests/testthat/test_pipeop_modelmatrix.R +++ b/tests/testthat/test_pipeop_modelmatrix.R @@ -8,7 +8,7 @@ test_that("PipeOpModelMatrix - basic properties", { constargs = list(param_vals = list(formula = ~ . ^ 2)), task = task) # Intercept - op = PipeOpModelMatrix$new(param_vals = list(formula = ~ . ^ 2)) + op = po("modelmatrix", formula = ~ . ^ 2) expect_pipeop(op) nt = train_pipeop(op, inputs = list(task))[[1L]] fn = nt$feature_names @@ -31,7 +31,7 @@ test_that("PipeOpModelMatrix - basic properties", { }) # Without intercept - op = PipeOpModelMatrix$new(param_vals = list(formula = ~ 0 + Sepal.Length)) + op = po("modelmatrix", formula = ~ 0 + Sepal.Length) expect_pipeop(op) nt = train_pipeop(op, inputs = list(task))[[1L]] fn = nt$feature_names @@ -42,8 +42,8 @@ test_that("PipeOpModelMatrix - basic properties", { expect_datapreproc_pipeop_class(PipeOpModelMatrix, constargs = list(param_vals = list(formula = ~ 0 + Sepal.Length + log(Sepal.Length))), task = task) - op = PipeOpModelMatrix$new(param_vals = list(formula = ~ 0 + Sepal.Length + - log(Sepal.Length))) + op = po("modelmatrix", formula = ~ 0 + Sepal.Length + + log(Sepal.Length)) expect_pipeop(op) nt = train_pipeop(op, inputs = list(task))[[1L]] fn = nt$feature_names @@ -53,8 +53,8 @@ test_that("PipeOpModelMatrix - basic properties", { # Interactions with factors task = mlr_tasks$get("german_credit") - op = PipeOpModelMatrix$new(param_vals = list(formula = ~ 0 + - foreign_worker:other_installment_plans)) + op = po("modelmatrix", formula = ~ 0 + + foreign_worker:other_installment_plans) expect_pipeop(op) nt = train_pipeop(op, inputs = list(task))[[1L]] fn = nt$feature_names diff --git a/tests/testthat/test_pipeop_multiplicityexply.R b/tests/testthat/test_pipeop_multiplicityexply.R index 6be3a28ac..670531e5c 100644 --- a/tests/testthat/test_pipeop_multiplicityexply.R +++ b/tests/testthat/test_pipeop_multiplicityexply.R @@ -1,7 +1,7 @@ context("PipeOpMultiplicityExply") test_that("multiplicityexply - basic properties", { - po = PipeOpMultiplicityExply$new(3) + po = po("multiplicityexply", outnum = 3) expect_pipeop(po) expect_data_table(po$input, nrows = 1) expect_data_table(po$output, nrows = 3) @@ -17,7 +17,7 @@ test_that("multiplicityexply - train and predict", { t1 = tsk$clone()$select(keep1) t2 = tsk$clone()$select(keep2) - po = PipeOpMultiplicityExply$new(2) + po = po("multiplicityexply", outnum = 2) tout = train_pipeop(po, list(as.Multiplicity(list(t1, t2)))) expect_list(po$state, len = 0) expect_list(tout, len = 2) diff --git a/tests/testthat/test_pipeop_multiplicityimply.R b/tests/testthat/test_pipeop_multiplicityimply.R index c855449c4..c6c43ddcd 100644 --- a/tests/testthat/test_pipeop_multiplicityimply.R +++ b/tests/testthat/test_pipeop_multiplicityimply.R @@ -1,7 +1,7 @@ context("PipeOpMultiplicityImply") test_that("multiplicityimply - basic properties", { - po = PipeOpMultiplicityImply$new(3) + po = po("multiplicityimply", innum = 3) expect_pipeop(po) expect_data_table(po$input, nrows = 3) expect_data_table(po$output, nrows = 1) @@ -9,7 +9,7 @@ test_that("multiplicityimply - basic properties", { expect_pipeop_class(PipeOpMultiplicityImply, list(1)) expect_pipeop_class(PipeOpMultiplicityImply, list(3)) - po = PipeOpMultiplicityImply$new() + po = po("multiplicityimply") expect_pipeop(po) expect_data_table(po$input, nrows = 1) expect_data_table(po$output, nrows = 1) @@ -22,7 +22,7 @@ test_that("multiplicityimply - train and predict", { t1 = tsk$clone()$select(keep1) t2 = tsk$clone()$select(keep2) - po = PipeOpMultiplicityImply$new(2) + po = po("multiplicityimply", innum = 2) tout = train_pipeop(po, list(t1, t2)) expect_list(po$state, len = 0) expect_multiplicity(tout[[1]]) @@ -33,7 +33,7 @@ test_that("multiplicityimply - train and predict", { expect_equal(pout[[1]][[1]], t1) expect_equal(pout[[1]][[2]], t2) - po = PipeOpMultiplicityImply$new() + po = po("multiplicityimply") tout = train_pipeop(po, list(t1, t2)) expect_list(po$state, len = 0) expect_multiplicity(tout[[1]]) @@ -44,7 +44,7 @@ test_that("multiplicityimply - train and predict", { expect_equal(pout[[1]][[1]], t1) expect_equal(pout[[1]][[2]], t2) - po = PipeOpMultiplicityImply$new(c("t1", "t2")) + po = po("multiplicityimply", innum = c("t1", "t2")) tout = train_pipeop(po, list(t1, t2)) expect_list(po$state, len = 0) expect_multiplicity(tout[[1]]) @@ -57,12 +57,12 @@ test_that("multiplicityimply - train and predict", { }) test_that("multiplicityimply innum names are used", { - po = PipeOpMultiplicityImply$new(2) + po = po("multiplicityimply", innum = 2) expect_names(names(po$train(list(1, 2))[[1]]), "unnamed") expect_names(names(po$predict(list(1, 2))[[1]]), "unnamed") expect_equal(po$input$name, c("input1", "input2")) - po = PipeOpMultiplicityImply$new(c("a", "b")) + po = po("multiplicityimply", innum = c("a", "b")) expect_equal(unclass(po$train(list(1, 2))[[1]]), list(a = 1, b = 2)) expect_equal(unclass(po$predict(list(3, 4))[[1]]), list(a = 3, b = 4)) expect_equal(po$input$name, c("a", "b")) diff --git a/tests/testthat/test_pipeop_mutate.R b/tests/testthat/test_pipeop_mutate.R index a566fa60e..602f7f262 100644 --- a/tests/testthat/test_pipeop_mutate.R +++ b/tests/testthat/test_pipeop_mutate.R @@ -1,7 +1,7 @@ context("PipeOpMutate") test_that("mutate", { - op = PipeOpMutate$new() + op = po("mutate") expect_pipeop(op) # Generic tests diff --git a/tests/testthat/test_pipeop_nearmiss.R b/tests/testthat/test_pipeop_nearmiss.R index 79ce1f7fc..b6c3ada2f 100644 --- a/tests/testthat/test_pipeop_nearmiss.R +++ b/tests/testthat/test_pipeop_nearmiss.R @@ -11,7 +11,7 @@ test_that("PipeOpNearmiss - basic properties", { test_that("PipeOpNearmiss - train works as intended", { skip_if_not_installed("themis") - op = PipeOpNearmiss$new() + op = po("nearmiss") # Compare to themis::nearmiss for task with only numeric/integer features task = mlr_tasks$get("wine") diff --git a/tests/testthat/test_pipeop_ovr.R b/tests/testthat/test_pipeop_ovr.R index a0b5f8352..1009ff71a 100644 --- a/tests/testthat/test_pipeop_ovr.R +++ b/tests/testthat/test_pipeop_ovr.R @@ -1,7 +1,7 @@ context("PipeOpOVRSplit") test_that("PipeOpOVRSplit - basic properties", { - po = PipeOpOVRSplit$new() + po = po("ovrsplit") expect_pipeop(po) expect_data_table(po$input, nrows = 1) expect_data_table(po$output, nrows = 1) @@ -13,7 +13,7 @@ test_that("PipeOpOVRSplit - train and predict", { # toy task to split dat = data.table(target = as.factor(rep(c("a", "b", "rest"), each = 10)), feature = rnorm(30)) tsk = TaskClassif$new("test", backend = dat, target = "target") - po = PipeOpOVRSplit$new() + po = po("ovrsplit") tout = train_pipeop(po, list(tsk)) expect_equal(po$state$levels, tsk$class_names) @@ -40,7 +40,7 @@ test_that("PipeOpOVRSplit - train and predict", { context("PipeOpOVRUnite") test_that("PipeOpOVRUnite - basic properties", { - po = PipeOpOVRUnite$new() + po = po("ovrunite") expect_pipeop(po) expect_data_table(po$input, nrows = 1) expect_data_table(po$output, nrows = 1) @@ -58,7 +58,7 @@ test_that("PipeOpOVRUnite- train and predict", { tsk1 = TaskClassif$new("t1", backend = dat1, target = "target", positive = "a") tsk2 = TaskClassif$new("t2", backend = dat2, target = "target", positive = "b") tsk3 = TaskClassif$new("t3", backend = dat3, target = "target", positive = "c") - po = PipeOpOVRUnite$new() + po = po("ovrunite") lrn = LearnerClassifRpart$new() # predict_type "prob" @@ -108,7 +108,7 @@ test_that("PipeOpOVRSplit and PipeOpOVRUnite - train and predict", { tsk1 = TaskClassif$new("t1", backend = dat1, target = "target", positive = "a") tsk2 = TaskClassif$new("t2", backend = dat2, target = "target", positive = "b") tsk3 = TaskClassif$new("t3", backend = dat3, target = "target", positive = "c") - po = PipeOpOVRUnite$new() + po = po("ovrunite") lrn = LearnerClassifRpart$new() tin = map(list(tsk1, tsk2, tsk3), .f = function(task) { lrn$train(task) @@ -118,7 +118,7 @@ test_that("PipeOpOVRSplit and PipeOpOVRUnite - train and predict", { po$train(list(as.Multiplicity(NULL))) pout_ref = po$predict(list(as.Multiplicity(tin))) - gr = PipeOpOVRSplit$new() %>>% LearnerClassifRpart$new() %>>% PipeOpOVRUnite$new() + gr = po("ovrsplit") %>>% LearnerClassifRpart$new() %>>% po("ovrunite") expect_graph(gr) tout = gr$train(tsk0) expect_list(gr$state$ovrunite, len = 0) @@ -134,7 +134,7 @@ test_that("PipeOpOVRSplit and PipeOpOVRUnite - train and predict", { test_that("PipeOpOVRSplit and PipeOpOVRUnite - task size", { skip_if_not_installed("rpart") - gr = PipeOpOVRSplit$new() %>>% LearnerClassifRpart$new() %>>% PipeOpOVRUnite$new() + gr = po("ovrsplit") %>>% LearnerClassifRpart$new() %>>% po("ovrunite") gr$train(tsk("iris")$filter(c(1:30, 51:80, 101:130))) prd = gr$predict(tsk("iris")$filter(c(1:30, 51:80, 101:130)))[[1]] expect_prediction_classif(prd) diff --git a/tests/testthat/test_pipeop_pca.R b/tests/testthat/test_pipeop_pca.R index b6bb7b0d9..f727c918a 100644 --- a/tests/testthat/test_pipeop_pca.R +++ b/tests/testthat/test_pipeop_pca.R @@ -1,7 +1,7 @@ context("PipeOpPCA") test_that("PipeOpPCA - basic properties", { - op = PipeOpPCA$new() + op = po("pca") task = mlr_tasks$get("iris") expect_pipeop(op) @@ -11,7 +11,7 @@ test_that("PipeOpPCA - basic properties", { test_that("PipeOpPCA works as expected", { - op = PipeOpPCA$new() + op = po("pca") task = mlr_tasks$get("iris") ip = op$train(list(task)) diff --git a/tests/testthat/test_pipeop_proxy.R b/tests/testthat/test_pipeop_proxy.R index bc50ae73b..0e05be27a 100644 --- a/tests/testthat/test_pipeop_proxy.R +++ b/tests/testthat/test_pipeop_proxy.R @@ -2,7 +2,7 @@ context("PipeOpProxy") test_that("PipeOpProxy - basic properties", { task = mlr_tasks$get("iris") - pop = PipeOpProxy$new(param_vals = list(content = PipeOpNOP$new())) + pop = po("proxy", content = PipeOpNOP$new()) expect_pipeop(pop) expect_equal(train_pipeop(pop, inputs = list(task))[[1L]], task) expect_equal(pop$state, list(nop = list())) @@ -10,21 +10,21 @@ test_that("PipeOpProxy - basic properties", { }) test_that("PipeOpProxy - datapreproc", { - pop = PipeOpScale$new() + pop = po("scale") expect_datapreproc_pipeop_class(PipeOpProxy, constargs = list(param_vals = list(content = pop)), task = mlr_tasks$get("iris")) }) test_that("PipeOpProxy - content error handling", { - expect_error(PipeOpProxy$new(param_vals = list(content = "error")), regexp = "`content` must be an object that can be converted to a Graph") - expect_error(PipeOpProxy$new(param_vals = list(content = PipeOpCopy$new(outnum = 2L))), regexp = "Graph's output number must either be 1 or match `outnum`") - expect_error(PipeOpProxy$new(param_vals = list(content = PipeOpFeatureUnion$new(innum = 3L)), innum = 2), regexp = "Graph's input number .* match `innum`") + expect_error(po("proxy", content = "error"), regexp = "`content` must be an object that can be converted to a Graph") + expect_error(po("proxy", content = PipeOpCopy$new(outnum = 2L)), regexp = "Graph's output number must either be 1 or match `outnum`") + expect_error(po("proxy", content = PipeOpFeatureUnion$new(innum = 3L), innum = 2), regexp = "Graph's input number .* match `innum`") }) test_that("PipeOpProxy - several inputs via featureunion", { task1 = mlr_tasks$get("iris") task2 = mlr_tasks$get("iris") - gr1 = PipeOpCopy$new(outnum = 2L) %>>% gunion(list(PipeOpNOP$new(), PipeOpPCA$new())) %>>% PipeOpProxy$new(param_vals = list(content = PipeOpFeatureUnion$new())) - gr2 = PipeOpCopy$new(outnum = 2L) %>>% gunion(list(PipeOpNOP$new(), PipeOpPCA$new())) %>>% PipeOpFeatureUnion$new() + gr1 = po("copy", outnum = 2L) %>>% gunion(list(PipeOpNOP$new(), po("pca"))) %>>% po("proxy", content = PipeOpFeatureUnion$new()) + gr2 = po("copy", outnum = 2L) %>>% gunion(list(PipeOpNOP$new(), po("pca"))) %>>% po("featureunion") tout1 = gr1$train(task1) tout2 = gr2$train(task2) expect_equal(tout1[[1L]], tout2[[1L]]) @@ -33,8 +33,8 @@ test_that("PipeOpProxy - several inputs via featureunion", { test_that("PipeOpProxy - several outputs", { task1 = mlr_tasks$get("iris") task2 = mlr_tasks$get("iris") - pop = PipeOpProxy$new(outnum = 2L, param_vals = list(content = PipeOpCopy$new(outnum = 2L))) - pop_copy = PipeOpCopy$new(outnum = 2L) + pop = po("proxy", outnum = 2L, content = PipeOpCopy$new(outnum = 2L)) + pop_copy = po("copy", outnum = 2L) tout1 = pop$train(list(task1)) tout2 = pop_copy$train(list(task2)) expect_equal(tout1, tout2) @@ -43,9 +43,9 @@ test_that("PipeOpProxy - several outputs", { test_that("PipeOpProxy - PCA proxied", { task1 = mlr_tasks$get("iris") task2 = mlr_tasks$get("iris") - pop = PipeOpProxy$new(param_vals = list(content = - PipeOpPCA$new(param_vals = list(center = TRUE, scale. = TRUE, rank. = 1L)))) - pop_pca = PipeOpPCA$new(param_vals = list(center = TRUE, scale. = TRUE, rank. = 1L)) + pop = po("proxy", content = + po("pca", center = TRUE, scale. = TRUE, rank. = 1L)) + pop_pca = po("pca", center = TRUE, scale. = TRUE, rank. = 1L) task1 = mlr_tasks$get("iris") task2 = task1$clone(deep = TRUE) tout = train_pipeop(pop, list(task1)) @@ -54,11 +54,11 @@ test_that("PipeOpProxy - PCA proxied", { }) test_that("PipeOpProxy - Graph proxied", { - pop = PipeOpProxy$new(param_vals = list(content = - PipeOpScale$new() %>>% - PipeOpPCA$new(param_vals = list(center = TRUE, scale. = TRUE, rank. = 1L)))) - gr = PipeOpScale$new() %>>% - PipeOpPCA$new(param_vals = list(center = TRUE, scale. = TRUE, rank. = 1L)) + pop = po("proxy", content = + po("scale") %>>% + po("pca", center = TRUE, scale. = TRUE, rank. = 1L)) + gr = po("scale") %>>% + po("pca", center = TRUE, scale. = TRUE, rank. = 1L) task1 = mlr_tasks$get("iris") task2 = task1$clone(deep = TRUE) tout = train_pipeop(pop, list(task1)) diff --git a/tests/testthat/test_pipeop_quantilebin.R b/tests/testthat/test_pipeop_quantilebin.R index c8b414cc8..971bd7735 100644 --- a/tests/testthat/test_pipeop_quantilebin.R +++ b/tests/testthat/test_pipeop_quantilebin.R @@ -7,7 +7,7 @@ test_that("PipeOpQuantileBin - basic properties", { test_that("PipeOpQuantileBin - see if expected result is returned", { task = mlr_tasks$get("iris") - op = PipeOpQuantileBin$new() + op = po("quantilebin") expect_pipeop(op) result = op$train(list(task)) @@ -16,7 +16,7 @@ test_that("PipeOpQuantileBin - see if expected result is returned", { function(x) expect_equal(length(unique(x)), 2)) # 5 bins - op5 = PipeOpQuantileBin$new(param_vals = list(numsplits = 5)) + op5 = po("quantilebin", numsplits = 5) expect_pipeop(op5) result = op5$train(list(task)) b = apply(as.data.frame(result[[1]]$data()[, 2:5]), MARGIN = 2, diff --git a/tests/testthat/test_pipeop_randomprojection.R b/tests/testthat/test_pipeop_randomprojection.R index 0bf6633dc..f5cc1fd0d 100644 --- a/tests/testthat/test_pipeop_randomprojection.R +++ b/tests/testthat/test_pipeop_randomprojection.R @@ -2,13 +2,13 @@ context("RandomProjection") test_that("basic properties", { task = mlr_tasks$get("iris") - op = PipeOpRandomProjection$new() + op = po("randomprojection") expect_datapreproc_pipeop_class(PipeOpRandomProjection, task = task, deterministic_train = FALSE) }) test_that("projection properties", { task = mlr_tasks$get("iris") - op = PipeOpRandomProjection$new() + op = po("randomprojection") set.seed(1234) result = op$train(list(task)) resdt = result[[1]]$data() diff --git a/tests/testthat/test_pipeop_randomresponse.R b/tests/testthat/test_pipeop_randomresponse.R index 486340879..d70099971 100644 --- a/tests/testthat/test_pipeop_randomresponse.R +++ b/tests/testthat/test_pipeop_randomresponse.R @@ -3,9 +3,9 @@ context("PipeOpRandomResponse") test_that("basic properties", { expect_pipeop_class(PipeOpRandomResponse) - expect_error(PipeOpCopy$new(param_vals = list(rdistfun = function(n) {}))) + expect_error(po("copy", rdistfun = function(n) {})) - po = PipeOpRandomResponse$new() + po = po("randomresponse") expect_pipeop(po) expect_data_table(po$input, nrows = 1) expect_data_table(po$output, nrows = 1) @@ -17,7 +17,7 @@ test_that("train and predict", { skip_if_not_installed("rpart") task1 = mlr_tasks$get("iris") task1$row_roles$use = c(1:10, 140:150) - g1 = LearnerClassifRpart$new() %>>% PipeOpRandomResponse$new() + g1 = LearnerClassifRpart$new() %>>% po("randomresponse") g1$pipeops$classif.rpart$learner$predict_type = "prob" train_out1 = g1$train(task1) expect_list(train_out1) @@ -31,12 +31,12 @@ test_that("train and predict", { learner1 = LearnerClassifRpart$new() learner1$train(task1) - g1x = LearnerClassifRpart$new() %>>% PipeOpRandomResponse$new() + g1x = LearnerClassifRpart$new() %>>% po("randomresponse") g1x$train(task1) expect_equal(g1x$predict(task1)[[1L]], learner1$predict(task1)) task2 = mlr_tasks$get("mtcars") - g2 = mlr3learners::LearnerRegrLM$new() %>>% PipeOpRandomResponse$new() + g2 = mlr3learners::LearnerRegrLM$new() %>>% po("randomresponse") g2$pipeops$regr.lm$learner$predict_type = "se" train_out2 = g2$train(task2) expect_list(train_out2) @@ -57,7 +57,7 @@ test_that("train and predict", { learner2 = mlr3learners::LearnerRegrLM$new() learner2$train(task2) - g2x = mlr3learners::LearnerRegrLM$new() %>>% PipeOpRandomResponse$new() + g2x = mlr3learners::LearnerRegrLM$new() %>>% po("randomresponse") g2x$train(task2) expect_equal(g2x$predict(task2)[[1L]], learner2$predict(task2)) }) diff --git a/tests/testthat/test_pipeop_removeconstants.R b/tests/testthat/test_pipeop_removeconstants.R index 1e596e031..38bc25f79 100644 --- a/tests/testthat/test_pipeop_removeconstants.R +++ b/tests/testthat/test_pipeop_removeconstants.R @@ -12,7 +12,7 @@ test_that("PipeOpRemoveConstants removes expected cols", { task$cbind(data.table(xx = rep(1, 506), yy = rep("a", 506), xx1 = c(2, rep(1, 505)), yy1 = c("b", rep("a", 505)))) - po = PipeOpRemoveConstants$new() + po = po("removeconstants") cn = po$train(list(task))[[1]]$feature_names @@ -38,7 +38,7 @@ test_that("PipeOpRemoveConstants removes expected cols", { test_dropping = function(data, expected_data, params) { intask = TaskClassif$new("iris", cbind(data, target = factor(c("x", rep("y", nrow(data) - 1)))), "target") - resulttask = PipeOpRemoveConstants$new(param_vals = params)$train(list(intask))[[1]] + resulttask = po("removeconstants", !!!params)$train(list(intask))[[1]] expect_equal(resulttask$data(cols = resulttask$feature_names), as.data.table(expected_data), ignore.col.order = TRUE) } diff --git a/tests/testthat/test_pipeop_renamecolumns.R b/tests/testthat/test_pipeop_renamecolumns.R index 2439a1d11..0890639dc 100644 --- a/tests/testthat/test_pipeop_renamecolumns.R +++ b/tests/testthat/test_pipeop_renamecolumns.R @@ -2,14 +2,14 @@ context("PipeOpRenameColumns") test_that("basic properties", { task = mlr_tasks$get("iris") - op = PipeOpRenameColumns$new() + op = po("renamecolumns") expect_datapreproc_pipeop_class(PipeOpRenameColumns, task = task, predict_like_train = TRUE) }) test_that("renaming works", { task = mlr_tasks$get("iris") task$cbind(data.table(Petal.Width = as.character(1:150))) # need a char column that we can turn into the 'name'-col - op = PipeOpRenameColumns$new(param_vals = list(renaming = c("Petal.Length" = "PL"))) + op = po("renamecolumns", renaming = c("Petal.Length" = "PL")) train_out1 = op$train(list(task))[[1L]] predict_out1 = op$predict(list(task))[[1L]] expect_equal(train_out1, predict_out1) @@ -34,7 +34,7 @@ test_that("renaming works", { test_that("error handling", { task = mlr_tasks$get("iris") - op = PipeOpRenameColumns$new(param_vals = list(renaming = c("Test" = "Newtest"))) + op = po("renamecolumns", renaming = c("Test" = "Newtest")) expect_error(op$train(list(task)), "The names Test from.*were not found in the Task") op$param_set$values$ignore_missing = TRUE expect_equal(task$data(), op$train(list(task))[[1]]$data()) diff --git a/tests/testthat/test_pipeop_replicate.R b/tests/testthat/test_pipeop_replicate.R index 11c41f106..901f3ebfb 100644 --- a/tests/testthat/test_pipeop_replicate.R +++ b/tests/testthat/test_pipeop_replicate.R @@ -1,7 +1,7 @@ context("PipeOpReplicate") test_that("PipeOpReplicate - basic properties", { - po = PipeOpReplicate$new() + po = po("replicate") expect_pipeop(po) expect_data_table(po$input, nrows = 1) expect_data_table(po$output, nrows = 1) @@ -12,7 +12,7 @@ test_that("PipeOpReplicate - basic properties", { test_that("PipeOpReplicate - train and predict", { tsk = mlr_tasks$get("iris") nreps = 3 - po = PipeOpReplicate$new(param_vals = list(reps = nreps)) + po = po("replicate", reps = nreps) tout = train_pipeop(po, list(tsk)) expect_list(po$state, len = 0) diff --git a/tests/testthat/test_pipeop_rowapply.R b/tests/testthat/test_pipeop_rowapply.R index 7267911c4..873eaca7f 100644 --- a/tests/testthat/test_pipeop_rowapply.R +++ b/tests/testthat/test_pipeop_rowapply.R @@ -1,13 +1,13 @@ context("PipeOpRowApply") test_that("PipeOpRowApply - basic properties", { - op = PipeOpRowApply$new() + op = po("rowapply") task = mlr_tasks$get("iris") expect_datapreproc_pipeop_class(PipeOpRowApply, task = task) }) test_that("PipeOpRowApply - transform on task with only numeric features", { - op = PipeOpRowApply$new() + op = po("rowapply") task = mlr_tasks$get("iris") cnames = task$feature_names iris = task$data(cols = cnames) @@ -99,7 +99,7 @@ test_that("PipeOpRowApply - transform on task with only numeric features", { test_that("PipeOpRowApply - transform works on task with only integer features", { - op = PipeOpRowApply$new() + op = po("rowapply") task = mlr_tasks$get("german_credit")$select(c("age", "amount", "duration")) cnames = task$feature_names german_credit = task$data(cols = cnames) @@ -191,7 +191,7 @@ test_that("PipeOpRowApply - transform works on task with only integer features", test_that("PipeOpRowApply - transform works on task with both numeric and integer features", { - op = PipeOpRowApply$new() + op = po("rowapply") task = mlr_tasks$get("wine") cnames = task$feature_names wine = task$data(cols = cnames) @@ -289,7 +289,7 @@ test_that("PipeOpRowApply - transform works on task with both numeric and intege test_that("PipeOpRowApply - transform works on task with only one row", { - op = PipeOpRowApply$new() + op = po("rowapply") task = mlr_tasks$get("wine")$filter(1) cnames = task$feature_names wine = task$data(cols = cnames) @@ -353,7 +353,7 @@ test_that("PipeOpRowApply - transform works on task with only one row", { test_that("PipeOpRowApply - transform works on empty task (no rows)", { - op = PipeOpRowApply$new() + op = po("rowapply") task = mlr_tasks$get("wine")$clone(deep = TRUE)$filter(integer(0)) cnames = task$feature_names @@ -424,7 +424,7 @@ test_that("PipeOpRowApply - transform works on empty task (no rows)", { test_that("PipeOpRowApply - transform works for empty predict task (no rows)", { - op = PipeOpRowApply$new() + op = po("rowapply") task_train = mlr_tasks$get("wine") task_predict = task_train$clone(deep = TRUE)$filter(integer(0)) cnames = task_train$feature_names @@ -479,7 +479,7 @@ test_that("PipeOpRowApply - transform works for empty predict task (no rows)", { test_that("PipeOpRowApply - transform works on task with no numeric or integer columns", { - op = PipeOpRowApply$new() + op = po("rowapply") task = mlr_tasks$get("penguins")$select(c("island", "sex")) cnames = task$feature_names diff --git a/tests/testthat/test_pipeop_scale.R b/tests/testthat/test_pipeop_scale.R index ec3d9abd2..092d1d552 100644 --- a/tests/testthat/test_pipeop_scale.R +++ b/tests/testthat/test_pipeop_scale.R @@ -1,7 +1,7 @@ context("PipeOpScale") test_that("PipeOpScale - basic properties", { - op = PipeOpScale$new() + op = po("scale") task = mlr_tasks$get("iris") expect_datapreproc_pipeop_class(PipeOpScale, task = task) }) @@ -31,7 +31,7 @@ test_that("basic properties", { task = TaskClassif$new(id = "test", target = "class", as_data_backend(data)) - po = PipeOpScale$new() + po = po("scale") po$param_set$values[c("center", "scale")] = c(FALSE, FALSE) diff --git a/tests/testthat/test_pipeop_scalemaxabs.R b/tests/testthat/test_pipeop_scalemaxabs.R index ae4386945..49e1c2cd7 100644 --- a/tests/testthat/test_pipeop_scalemaxabs.R +++ b/tests/testthat/test_pipeop_scalemaxabs.R @@ -2,7 +2,7 @@ context("PipeOpScaleMaxAbs") test_that("PipeOpScaleMaxAbs - basic properties", { task = mlr_tasks$get("iris") - op = PipeOpScaleMaxAbs$new() + op = po("scalemaxabs") expect_datapreproc_pipeop_class(PipeOpScaleMaxAbs, task = task) set.seed(1234) @@ -15,7 +15,7 @@ test_that("PipeOpScaleMaxAbs - basic properties", { test_that("Other maxabs", { task = mlr_tasks$get("iris") - op = PipeOpScaleMaxAbs$new(param_vals = list(maxabs = 0.6)) + op = po("scalemaxabs", maxabs = 0.6) set.seed(1234) resdt = op$train(list(task))[[1L]]$data() expect_true(all(sapply(resdt[, 2:5], max) == 0.6)) diff --git a/tests/testthat/test_pipeop_scalerange.R b/tests/testthat/test_pipeop_scalerange.R index a998ba84c..2be622876 100644 --- a/tests/testthat/test_pipeop_scalerange.R +++ b/tests/testthat/test_pipeop_scalerange.R @@ -2,7 +2,7 @@ context("PipeOpScaleRange") test_that("PipeOpScaleRange - basic properties", { task = mlr_tasks$get("iris") - op = PipeOpScaleRange$new() + op = po("scalerange") expect_datapreproc_pipeop_class(PipeOpScaleRange, task = task) @@ -15,7 +15,7 @@ test_that("PipeOpScaleRange - basic properties", { test_that("Other maxabs", { task = mlr_tasks$get("iris") - op = PipeOpScaleRange$new(param_vals = list(upper = 0.6, lower = 0.2)) + op = po("scalerange", upper = 0.6, lower = 0.2) set.seed(1234) resdt = op$train(list(task))[[1]]$data() resdt.max = sapply(resdt[, 2:5], max) diff --git a/tests/testthat/test_pipeop_select.R b/tests/testthat/test_pipeop_select.R index 279e5e8f1..96a769337 100644 --- a/tests/testthat/test_pipeop_select.R +++ b/tests/testthat/test_pipeop_select.R @@ -1,7 +1,7 @@ context("PipeOpSelect") test_that("select", { - op = PipeOpSelect$new() + op = po("select") expect_pipeop(op) # Generic tests @@ -13,7 +13,7 @@ test_that("select", { # Selects the columns we expect it to select - po = PipeOpSelect$new() + po = po("select") expect_equal(po$train(list(tsk("iris")))[[1]]$data(), mlr_tasks$get("iris")$data()) po$param_set$values$selector = selector_grep("^Petal") diff --git a/tests/testthat/test_pipeop_smote.R b/tests/testthat/test_pipeop_smote.R index e53783328..b4fdd7553 100644 --- a/tests/testthat/test_pipeop_smote.R +++ b/tests/testthat/test_pipeop_smote.R @@ -10,7 +10,7 @@ test_that("PipeOpSmote - basic properties", { expect_datapreproc_pipeop_class(PipeOpSmote, task = task, predict_like_train = FALSE, deterministic_train = FALSE) - op = PipeOpSmote$new(param_vals = list(K = 3)) + op = po("smote", K = 3) set.seed(1234) result = train_pipeop(op, inputs = list(task)) @@ -24,7 +24,7 @@ test_that("compare to smotefamily::SMOTE", { data = smotefamily::sample_generator(1000, ratio = 0.80) data$result = as.factor(data$result) task = TaskClassif$new(id = "unbalanced", backend = data, target = "result") - op = PipeOpSmote$new(param_vals = list(K = 3)) + op = po("smote", K = 3) set.seed(1234) result = train_pipeop(op, inputs = list(task)) @@ -37,7 +37,7 @@ test_that("compare to smotefamily::SMOTE", { test_that("PipeOpSmote - handling of feature named 'class'", { skip_if_not_installed("smotefamily") - op = PipeOpSmote$new() + op = po("smote") df = data.frame( target = factor(sample(c("c1", "c2"), size = 200, replace = TRUE, prob = c(0.1, 0.9))), diff --git a/tests/testthat/test_pipeop_smotenc.R b/tests/testthat/test_pipeop_smotenc.R index befe26683..b2198293b 100644 --- a/tests/testthat/test_pipeop_smotenc.R +++ b/tests/testthat/test_pipeop_smotenc.R @@ -12,7 +12,7 @@ test_that("PipeOpSmoteNC - basic properties", { test_that("PipeOpSmoteNC - train works as intended", { skip_if_not_installed("themis") - op = PipeOpSmoteNC$new() + op = po("smotenc") df_unbalanced = data.frame( class = factor(rep(c("pos", "neg"), times = c(150, 50))), x1 = rnorm(200), diff --git a/tests/testthat/test_pipeop_spatialsign.R b/tests/testthat/test_pipeop_spatialsign.R index f475c6cb6..b4b85214c 100644 --- a/tests/testthat/test_pipeop_spatialsign.R +++ b/tests/testthat/test_pipeop_spatialsign.R @@ -2,14 +2,14 @@ context("PipeOpSpatialSign") test_that("PipeOpSpatialSign - general functionality", { task = mlr_tasks$get("iris") - op = PipeOpSpatialSign$new() + op = po("spatialsign") expect_datapreproc_pipeop_class(PipeOpSpatialSign, task = task) }) test_that("PipeOpSpatialSign - receive expected result", { # Length 1 task = mlr_tasks$get("iris") - op = PipeOpSpatialSign$new(param_vals = list(norm = 2, length = 1L)) + op = po("spatialsign", norm = 2, length = 1L) result = train_pipeop(op, inputs = list(task)) t = apply(result[[1]]$data()[, 2:5], MARGIN = 1, function(x) { expect_equal(sqrt(sum(x^2)), 1) @@ -21,7 +21,7 @@ test_that("PipeOpSpatialSign - receive expected result", { # Length 2 task = mlr_tasks$get("iris") - op = PipeOpSpatialSign$new(param_vals = list(norm = 2, length = 2)) + op = po("spatialsign", norm = 2, length = 2) result = train_pipeop(op, inputs = list(task)) t = apply(result[[1]]$data()[, 2:5], MARGIN = 1, function(x) { expect_equal(sqrt(sum(x^2)), 2) @@ -33,7 +33,7 @@ test_that("PipeOpSpatialSign - receive expected result", { # norm 1 task = mlr_tasks$get("iris") - op = PipeOpSpatialSign$new(param_vals = list(norm = 1, length = 1L)) + op = po("spatialsign", norm = 1, length = 1L) result = train_pipeop(op, inputs = list(task)) t = apply(result[[1]]$data()[, 2:5], MARGIN = 1, function(x) { expect_equal(sum(abs(x)), 1) @@ -45,7 +45,7 @@ test_that("PipeOpSpatialSign - receive expected result", { # norm inf task = mlr_tasks$get("iris") - op = PipeOpSpatialSign$new(param_vals = list(norm = Inf, length = 1L)) + op = po("spatialsign", norm = Inf, length = 1L) result = train_pipeop(op, inputs = list(task)) t = apply(result[[1]]$data()[, 2:5], MARGIN = 1, function(x) { expect_equal(max(abs(x)), 1) diff --git a/tests/testthat/test_pipeop_subsample.R b/tests/testthat/test_pipeop_subsample.R index bab46e611..982a946d1 100644 --- a/tests/testthat/test_pipeop_subsample.R +++ b/tests/testthat/test_pipeop_subsample.R @@ -1,19 +1,19 @@ context("PipeOpSubsample") test_that("PipeOpSubsample - basic properties", { - op = PipeOpSubsample$new() + op = po("subsample") task = mlr_tasks$get("iris") expect_datapreproc_pipeop_class(PipeOpSubsample, task = task, predict_like_train = FALSE, deterministic_train = FALSE) }) test_that("PipeOpSubsample works unstratified", { task = mlr_tasks$get("iris") - po = PipeOpSubsample$new() + po = po("subsample") tnew = train_pipeop(po, list(task)) expect_true(tnew[[1]]$nrow == ceiling(po$param_set$values$frac * task$nrow)) - po = PipeOpSubsample$new() + po = po("subsample") po$param_set$values$frac = 0.7 tnew = train_pipeop(po, list(task)) @@ -25,11 +25,11 @@ test_that("PipeOpSubsample works unstratified", { expect_equal(pnew[[1]], task) task = mlr_tasks$get("iris")$filter(1L) # actually has to be an int m( - po = PipeOpSubsample$new() + po = po("subsample") tnew = train_pipeop(po, list(task)) task = mlr_tasks$get("boston_housing_classic")$filter(1L) # actually has to be an int m( - po = PipeOpSubsample$new() + po = po("subsample") po$param_set$values = list(stratify = TRUE, frac = 0.6) expect_error(train_pipeop(po, list(task))) }) @@ -37,7 +37,7 @@ test_that("PipeOpSubsample works unstratified", { test_that("PipeOpSubsample works stratified", { task = mlr_tasks$get("iris") - po = PipeOpSubsample$new() + po = po("subsample") po$param_set$values = list(stratify = TRUE, use_groups = FALSE, frac = 0.6, replace = FALSE) expect_class(po, "PipeOpSubsample") @@ -47,7 +47,7 @@ test_that("PipeOpSubsample works stratified", { expect_equal(table(tnew[[1]]$data(cols = tnew[[1]]$target_names)), table(list(Species = rep(c("setosa", "versicolor", "virginica"), 30)))) - po = PipeOpSubsample$new() + po = po("subsample") po$param_set$values = list(stratify = TRUE, use_groups = FALSE, frac = 0.6, replace = TRUE) expect_class(po, "PipeOpSubsample") @@ -69,7 +69,7 @@ test_that("PipeOpSubsample works stratified", { }) test_that("PipeOpSubsample - use_groups - Sanity Checks", { - op = PipeOpSubsample$new() + op = po("subsample") op$param_set$set_values(frac = 0.5) df_two = data.frame( @@ -125,7 +125,7 @@ test_that("PipeOpSubsample - use_groups - Sanity Checks", { }) test_that("PipeOpSubsample - use_groups - Modified row_roles$use", { - op = PipeOpSubsample$new() + op = po("subsample") op$param_set$set_values(replace = TRUE) test_df = data.frame( @@ -161,7 +161,7 @@ test_that("PipeOpSubsample - use_groups - Modified row_roles$use", { }) test_that("PipeOpSubsample - use_groups - Equal group sizes", { - op = PipeOpSubsample$new() + op = po("subsample") # Data with groups of the same size test_df = data.frame( @@ -196,7 +196,7 @@ test_that("PipeOpSubsample - use_groups - Equal group sizes", { }) test_that("PipeOpSubsample - use_groups - Large variance in group sizes", { - op = PipeOpSubsample$new() + op = po("subsample") # Data with one very large group set.seed(2024) diff --git a/tests/testthat/test_pipeop_targetinvert.R b/tests/testthat/test_pipeop_targetinvert.R index fe8def34b..fe12bdb40 100644 --- a/tests/testthat/test_pipeop_targetinvert.R +++ b/tests/testthat/test_pipeop_targetinvert.R @@ -3,7 +3,7 @@ context("PipeOpTargetInvert") test_that("PipeOpTargetInvert - basic properties", { expect_pipeop_class(PipeOpTargetInvert, list(id = "po")) - po = PipeOpTargetInvert$new("po") + po = po("targetinvert", id = "po") expect_pipeop(po) expect_data_table(po$input, nrows = 2L) diff --git a/tests/testthat/test_pipeop_targetmutate.R b/tests/testthat/test_pipeop_targetmutate.R index 9c4a1a119..b727b751a 100644 --- a/tests/testthat/test_pipeop_targetmutate.R +++ b/tests/testthat/test_pipeop_targetmutate.R @@ -11,7 +11,7 @@ test_that("PipeOpTargetMutate - basic properties", { g = Graph$new() g$add_pipeop(PipeOpTargetMutate$new()) g$add_pipeop(LearnerRegrRpart$new()) - g$add_pipeop(PipeOpTargetInvert$new()) + g$add_pipeop(po("targetinvert")) g$add_edge(src_id = "targetmutate", dst_id = "targetinvert", src_channel = 1L, dst_channel = 1L) g$add_edge(src_id = "targetmutate", dst_id = "regr.rpart", src_channel = 2L, dst_channel = 1L) g$add_edge(src_id = "regr.rpart", dst_id = "targetinvert", src_channel = 1L, dst_channel = 2L) @@ -48,7 +48,7 @@ test_that("PipeOpTargetMutate - log base 2 trafo", { ) ) g$add_pipeop(LearnerRegrRpart$new()) - g$add_pipeop(PipeOpTargetInvert$new()) + g$add_pipeop(po("targetinvert")) g$add_edge(src_id = "logtrafo", dst_id = "targetinvert", src_channel = 1L, dst_channel = 1L) g$add_edge(src_id = "logtrafo", dst_id = "regr.rpart", src_channel = 2L, dst_channel = 1L) g$add_edge(src_id = "regr.rpart", dst_id = "targetinvert", src_channel = 1L, dst_channel = 2L) diff --git a/tests/testthat/test_pipeop_targettrafoscalerange.R b/tests/testthat/test_pipeop_targettrafoscalerange.R index e291bd345..5cd0a205d 100644 --- a/tests/testthat/test_pipeop_targettrafoscalerange.R +++ b/tests/testthat/test_pipeop_targettrafoscalerange.R @@ -4,7 +4,7 @@ test_that("PipeOpTargetTrafoScaleRange - basic properties", { skip_if_not_installed("rpart") expect_pipeop_class(PipeOpTargetTrafoScaleRange, list(id = "po")) - po = PipeOpTargetTrafoScaleRange$new() + po = po("targettrafoscalerange") expect_pipeop(po) @@ -30,7 +30,7 @@ test_that("PipeOpTargetTrafoScaleRange - basic properties", { g = Graph$new() g$add_pipeop(po) g$add_pipeop(LearnerRegrRpart$new()) - g$add_pipeop(PipeOpTargetInvert$new()) + g$add_pipeop(po("targetinvert")) g$add_edge(src_id = "targettrafoscalerange", dst_id = "targetinvert", src_channel = 1L, dst_channel = 1L) g$add_edge(src_id = "targettrafoscalerange", dst_id = "regr.rpart", src_channel = 2L, dst_channel = 1L) g$add_edge(src_id = "regr.rpart", dst_id = "targetinvert", src_channel = 1L, dst_channel = 2L) @@ -50,7 +50,7 @@ test_that("PipeOpTargetTrafoScaleRange - basic properties", { test_that("PipeOpTargetTrafoScaleRange - row use subsets", { skip_if_not_installed("rpart") - po = PipeOpTargetTrafoScaleRange$new() + po = po("targettrafoscalerange") task = mlr_tasks$get("boston_housing_classic") @@ -71,9 +71,9 @@ test_that("PipeOpTargetTrafoScaleRange - row use subsets", { predict_out1 = learner$predict(taskfull) - g = PipeOpFixFactors$new() %>>% po + g = po("fixfactors") %>>% po g$add_pipeop(LearnerRegrRpart$new()) - g$add_pipeop(PipeOpTargetInvert$new()) + g$add_pipeop(po("targetinvert")) g$add_edge(src_id = "targettrafoscalerange", dst_id = "targetinvert", src_channel = 1L, dst_channel = 1L) g$add_edge(src_id = "targettrafoscalerange", dst_id = "regr.rpart", src_channel = 2L, dst_channel = 1L) g$add_edge(src_id = "regr.rpart", dst_id = "targetinvert", src_channel = 1L, dst_channel = 2L) diff --git a/tests/testthat/test_pipeop_textvectorizer.R b/tests/testthat/test_pipeop_textvectorizer.R index 4f13fa4b3..d524abc37 100644 --- a/tests/testthat/test_pipeop_textvectorizer.R +++ b/tests/testthat/test_pipeop_textvectorizer.R @@ -22,7 +22,7 @@ test_that("PipeOpTextVectorizer - basic properties", { })) task$cbind(dt) - op = PipeOpTextVectorizer$new(param_vals = list(stopwords_language = "none")) + op = po("textvectorizer", stopwords_language = "none") expect_pipeop(op) result = op$train(list(task))[[1]] expect_task(result) @@ -65,7 +65,7 @@ test_that("PipeOpTextVectorizer - tfidf works", { })) task$cbind(dt) - op = PipeOpTextVectorizer$new(param_vals = list(stopwords_language = "none", scheme_df = "inverse")) + op = po("textvectorizer", stopwords_language = "none", scheme_df = "inverse") expect_pipeop(op) result = op$train(list(task))[[1]] expect_task(result) @@ -136,7 +136,7 @@ test_that("PipeOpTextVectorizer - bigrams", { })) task$cbind(dt) - op = PipeOpTextVectorizer$new(param_vals = list(stopwords_language = "none")) + op = po("textvectorizer", stopwords_language = "none") expect_pipeop(op) result = op$train(list(task))[[1]] expect_task(result) @@ -174,7 +174,7 @@ test_that("PipeOpTextVectorizer - integer sequence", { })) task$cbind(dt) - op = PipeOpTextVectorizer$new(param_vals = list(stopwords_language = "none", return_type = "integer_sequence")) + op = po("textvectorizer", stopwords_language = "none", return_type = "integer_sequence") expect_pipeop(op) result = op$train(list(task))[[1]] expect_task(result) @@ -198,7 +198,7 @@ test_that("PipeOpTextVectorizer - integer sequence", { expect_true(prd$nrow == 0L) # Pad pad0 - op = PipeOpTextVectorizer$new(param_vals = list(stopwords_language = "none", return_type = "integer_sequence", sequence_length = 20L)) + op = po("textvectorizer", stopwords_language = "none", return_type = "integer_sequence", sequence_length = 20L) result = op$train(list(task))[[1]] dt2 = result$data() expect_true(ncol(dt2) == 25L) @@ -207,7 +207,7 @@ test_that("PipeOpTextVectorizer - integer sequence", { expect_true(prd$nrow == 1L) # Cut pad0 - op = PipeOpTextVectorizer$new(param_vals = list(stopwords_language = "none", return_type = "integer_sequence", sequence_length = 4L)) + op = po("textvectorizer", stopwords_language = "none", return_type = "integer_sequence", sequence_length = 4L) result = op$train(list(task))[[1]] dt2 = result$data() expect_true(ncol(dt2) == 9L) @@ -216,7 +216,7 @@ test_that("PipeOpTextVectorizer - integer sequence", { expect_true(prd$nrow == 1L) # OOB Newdata - op = PipeOpTextVectorizer$new(param_vals = list(stopwords_language = "none", return_type = "integer_sequence", sequence_length = 4L)) + op = po("textvectorizer", stopwords_language = "none", return_type = "integer_sequence", sequence_length = 4L) result = op$train(list(task$clone()$filter(2:3)))[[1]] prd = op$predict(list(task$clone()$filter(rows = 1L)))[[1]] expect_true(sum(prd$data()[, paste0("txt.V", 1:4)]) == 0) @@ -245,7 +245,7 @@ test_that("PipeOpTextVectorizer - factor sequence", { })) task$cbind(dt) - op = PipeOpTextVectorizer$new(param_vals = list(stopwords_language = "none", return_type = "factor_sequence")) + op = po("textvectorizer", stopwords_language = "none", return_type = "factor_sequence") expect_pipeop(op) result = op$train(list(task))[[1]] expect_task(result) @@ -263,7 +263,7 @@ test_that("PipeOpTextVectorizer - factor sequence", { # Pad pad0 nona = function(x) {x[!is.na(x)]} - op = PipeOpTextVectorizer$new(param_vals = list(stopwords_language = "none", return_type = "factor_sequence", sequence_length = 20L)) + op = po("textvectorizer", stopwords_language = "none", return_type = "factor_sequence", sequence_length = 20L) result = op$train(list(task))[[1]] dt2 = result$data() expect_true(ncol(dt2) == 25L) @@ -272,7 +272,7 @@ test_that("PipeOpTextVectorizer - factor sequence", { expect_true(prd$nrow == 1L) # Cut pad0 - op = PipeOpTextVectorizer$new(param_vals = list(stopwords_language = "none", return_type = "factor_sequence", sequence_length = 4L)) + op = po("textvectorizer", stopwords_language = "none", return_type = "factor_sequence", sequence_length = 4L) result = op$train(list(task))[[1]] dt2 = result$data() expect_true(ncol(dt2) == 9L) @@ -281,7 +281,7 @@ test_that("PipeOpTextVectorizer - factor sequence", { expect_true(prd$nrow == 1L) # OOB Newdata - op = PipeOpTextVectorizer$new(param_vals = list(stopwords_language = "none", return_type = "factor_sequence", sequence_length = 4L)) + op = po("textvectorizer", stopwords_language = "none", return_type = "factor_sequence", sequence_length = 4L) result = op$train(list(task$clone()$filter(2:3)))[[1]] prd = op$predict(list(task$clone()$filter(rows = 1L)))[[1]] expect_true(all(is.na(prd$data()[, paste0("txt.V", 1:4)])), info = paste(capture.output(print(prd$data())), collapse = "\n")) diff --git a/tests/testthat/test_pipeop_threshold.R b/tests/testthat/test_pipeop_threshold.R index 578f0caeb..d297b4a70 100644 --- a/tests/testthat/test_pipeop_threshold.R +++ b/tests/testthat/test_pipeop_threshold.R @@ -21,7 +21,7 @@ test_that("thresholding works for binary", { t = tsk("german_credit")$filter(rows = 1:100) # works with no args - po_thr = PipeOpThreshold$new() + po_thr = po("threshold") expect_pipeop(po_thr) gr = po_lrn %>>% po_thr gr$train(t) @@ -71,7 +71,7 @@ test_that("thresholding works for multiclass", { t = tsk("iris") # works with no args - po_thr = PipeOpThreshold$new() + po_thr = po("threshold") expect_pipeop(po_thr) gr = po_lrn %>>% po_thr gr$train(t) @@ -85,7 +85,7 @@ test_that("thresholding works for multiclass", { expect_prediction(prd[[1]]) # works with args - po_thr = PipeOpThreshold$new(param_vals = list(thresholds = c(0.3, 0.4, 0.3))) + po_thr = po("threshold", thresholds = c(0.3, 0.4, 0.3)) expect_pipeop(po_thr) gr = po_lrn %>>% po_thr gr$train(t) @@ -94,7 +94,7 @@ test_that("thresholding works for multiclass", { expect_true(all(gr$param_set$values$threshold.thresholds == c(0.3, 0.4, 0.3))) # works with named args - po_thr = PipeOpThreshold$new(param_vals = + po_thr = po("threshold", list(thresholds = c("virginica" = 0.3, "versicolor" = 0.4, "setosa" = 0.3))) expect_pipeop(po_thr) gr = po_lrn %>>% po_thr @@ -104,12 +104,12 @@ test_that("thresholding works for multiclass", { expect_true(all(gr$param_set$values$threshold.thresholds == c(0.3, 0.4, 0.3))) # errors with wrong args - po_thr = PipeOpThreshold$new(param_vals = list(thresholds = c(0.3, 0.4))) + po_thr = po("threshold", thresholds = c(0.3, 0.4)) gr = po_lrn %>>% po_thr gr$train(t) expect_error(gr$predict(t), "must have length one or length equal to number of outcome levels") - po_thr = PipeOpThreshold$new(param_vals = + po_thr = po("threshold", list(thresholds = c("foo" = 0.3, "versicolor" = 0.4, "setosa" = 0.3))) gr = po_lrn %>>% po_thr gr$train(t) diff --git a/tests/testthat/test_pipeop_tomek.R b/tests/testthat/test_pipeop_tomek.R index edb39887b..2e149ca03 100644 --- a/tests/testthat/test_pipeop_tomek.R +++ b/tests/testthat/test_pipeop_tomek.R @@ -11,7 +11,7 @@ test_that("PipeOpTomek - basic properties", { test_that("PipeOpTomek - train works as intended", { skip_if_not_installed("themis") - op = PipeOpTomek$new() + op = po("tomek") # Compare to themis::tomek for task with only numeric features task = mlr_tasks$get("iris") diff --git a/tests/testthat/test_pipeop_unbranch.R b/tests/testthat/test_pipeop_unbranch.R index 823798ff7..b6d54058a 100644 --- a/tests/testthat/test_pipeop_unbranch.R +++ b/tests/testthat/test_pipeop_unbranch.R @@ -2,7 +2,7 @@ context("PipeOpUnbranch") test_that("PipeOpUnbranch - basic properties", { - po = PipeOpUnbranch$new(3) + po = po("unbranch", options = 3) expect_pipeop(po) expect_data_table(po$input, nrows = 3) expect_data_table(po$output, nrows = 1) @@ -10,7 +10,7 @@ test_that("PipeOpUnbranch - basic properties", { expect_pipeop_class(PipeOpUnbranch, list(1)) expect_pipeop_class(PipeOpUnbranch, list(3)) - po = PipeOpUnbranch$new() + po = po("unbranch") expect_pipeop(po) expect_data_table(po$input, nrows = 1) }) @@ -20,7 +20,7 @@ test_that("PipeOpUnbranch - train and predict", { t1 = mlr_tasks$get("iris") t2 = mlr_tasks$get("pima") - ubranch = PipeOpUnbranch$new(2) + ubranch = po("unbranch", options = 2) expect_true(ubranch$innum == 2L) tout = train_pipeop(ubranch, (list(t1, NO_OP))) @@ -34,7 +34,7 @@ test_that("PipeOpUnbranch - train and predict", { expect_error(ubranch$train(list(t1, t2))) expect_error(ubranch$train(list(t1))) - ubranch = PipeOpUnbranch$new() + ubranch = po("unbranch") expect_true(ubranch$innum == 1) tout = train_pipeop(ubranch, (list(t1, NO_OP))) @@ -45,7 +45,7 @@ test_that("PipeOpUnbranch - train and predict", { expect_true(length(pout) == 1) expect_equal(pout[[1]], t2) - ubranch = PipeOpUnbranch$new() + ubranch = po("unbranch") tout = train_pipeop(ubranch, (list(t1))) expect_class(tout[[1]], "Task") expect_true(length(tout) == 1L) diff --git a/tests/testthat/test_pipeop_vtreat.R b/tests/testthat/test_pipeop_vtreat.R index faacddc4d..4dbb5b1ee 100644 --- a/tests/testthat/test_pipeop_vtreat.R +++ b/tests/testthat/test_pipeop_vtreat.R @@ -3,7 +3,7 @@ context("PipeOpVtreat") test_that("PipeOpVtreat - basic properties", { skip_if_not_installed("vtreat") - expect_pipeop(PipeOpVtreat$new()) + expect_pipeop(po("vtreat")) task_regr = mlr_tasks$get("boston_housing_classic") expect_datapreproc_pipeop_class(PipeOpVtreat, task = task_regr, deterministic_train = FALSE, deterministic_predict = FALSE) @@ -18,7 +18,7 @@ test_that("PipeOpVtreat - basic properties", { test_that("PipeOpVtreat - Regression", { skip_if_not_installed("vtreat") - op = PipeOpVtreat$new() + op = po("vtreat") # clean task simply passes through clean_task = TaskRegr$new("vtreat_regr_clean", backend = data.frame(y = c(-1, 0, 1), x = c(1, 1, 1)), target = "y") @@ -67,7 +67,7 @@ test_that("PipeOpVtreat - Regression", { test_that("PipeOpVtreat - Binary Classification", { skip_if_not_installed("vtreat") - op = PipeOpVtreat$new() + op = po("vtreat") # clean task simply passes through clean_task = TaskClassif$new("vtreat_binary_clean", backend = data.frame(y = as.factor(c(0, 0, 1, 1, 0)), x = c(1, 1, 1, 1, 1)), target = "y") @@ -117,7 +117,7 @@ test_that("PipeOpVtreat - Binary Classification", { test_that("PipeOpVtreat - Multiclass Classification", { skip_if_not_installed("vtreat") - op = PipeOpVtreat$new() + op = po("vtreat") # clean task simply passes through clean_task = TaskClassif$new("vtreat_multiclass_clean", backend = data.frame(y = as.factor(c(-1, 0, 1)), x = c(1, 1, 1)), target = "y") @@ -167,7 +167,7 @@ test_that("PipeOpVtreat - Multiclass Classification", { test_that("PipeOpVtreat - Edge Cases", { skip_if_not_installed("vtreat") - op = PipeOpVtreat$new() + op = po("vtreat") set.seed(3) dat = data.table(y = rnorm(12), x = as.factor(rep(c("a", "b", "c"), 4L)), @@ -178,7 +178,7 @@ test_that("PipeOpVtreat - Edge Cases", { task$col_roles[[if ("weights_learner" %in% names(task)) "weights_learner" else "weight"]] = "weights" task$col_roles$feature = "x" - po = PipeOpVtreat$new() + po = po("vtreat") train_out1 = po$train(list(task))[[1L]] predict_out1 = po$predict(list(task))[[1L]] diff --git a/tests/testthat/test_pipeop_yeojohnson.R b/tests/testthat/test_pipeop_yeojohnson.R index f20e7514f..05cd16a0f 100644 --- a/tests/testthat/test_pipeop_yeojohnson.R +++ b/tests/testthat/test_pipeop_yeojohnson.R @@ -3,14 +3,14 @@ context("PipeOpYeoJohnson") test_that("PipeOpYeoJohnson - general functionality", { skip_if_not_installed("bestNormalize") task = mlr_tasks$get("iris") - op = PipeOpYeoJohnson$new() + op = po("yeojohnson") expect_datapreproc_pipeop_class(PipeOpYeoJohnson, task = task) }) test_that("PipeOpYeoJohnson - receive expected result", { skip_if_not_installed("bestNormalize") task = mlr_tasks$get("iris") - op = PipeOpYeoJohnson$new(param_vals = list(standardize = FALSE)) + op = po("yeojohnson", standardize = FALSE) result = train_pipeop(op, inputs = list(task)) result.pred = predict_pipeop(op, inputs = list(task)) @@ -23,7 +23,7 @@ test_that("PipeOpYeoJohnson - receive expected result", { }) # Set lower and upper value for lambda estimation - op = PipeOpYeoJohnson$new(param_vals = list(upper = 0.5, lower = 0)) + op = po("yeojohnson", upper = 0.5, lower = 0) result = train_pipeop(op, inputs = list(task)) lambda.new = unlist(lapply(op$state$bc[1:4], function(x) x$lambda)) expect_true(all(lambda.new <= 0.5 & lambda.new >= 0)) diff --git a/tests/testthat/test_preproc.R b/tests/testthat/test_preproc.R index f3c2e2242..82a85359c 100644 --- a/tests/testthat/test_preproc.R +++ b/tests/testthat/test_preproc.R @@ -107,7 +107,7 @@ test_that("preproc - basic sanity checks", { test_that("preproc - PipeOp processor", { task = tsk("iris") dt = task$data(cols = task$feature_names) - processor = PipeOpScale$new() + processor = po("scale") expected_train_out_task = processor$train(list(task))[[1L]] expected_predict_out_task = processor$predict(list(task))[[1L]] expected_train_out_dt = expected_train_out_task$data(cols = task$feature_names) diff --git a/tests/testthat/test_resample.R b/tests/testthat/test_resample.R index bf165d298..6d7c26fe9 100644 --- a/tests/testthat/test_resample.R +++ b/tests/testthat/test_resample.R @@ -3,9 +3,9 @@ context("resample") test_that("PipeOp - Resample", { skip_if_not_installed("rpart") task = mlr_tasks$get("iris") - op1 = PipeOpScale$new() +op1 = po("scale") lrn = mlr_learners$get("classif.rpart") - op2 = PipeOpLearner$new(learner = lrn) +op2 = po("learner", lrn) pp = GraphLearner$new(op2) resa = mlr_resamplings$get("cv") resa$param_set$values$folds = 2L diff --git a/tests/testthat/test_typecheck.R b/tests/testthat/test_typecheck.R index bb1b7de60..11a214498 100644 --- a/tests/testthat/test_typecheck.R +++ b/tests/testthat/test_typecheck.R @@ -61,36 +61,36 @@ test_that("utility function works", { }) test_that("Graph is type-checking", { - expect_error(PipeOpScale$new() %>>% PipeOpRegrAvg$new(1), + expect_error(po("scale") %>>% po("regravg", innum = 1), "Output type of PipeOp scale during prediction \\(Task\\) incompatible with input type of PipeOp regravg \\(PredictionRegr\\)") - mavtest = PipeOpRegrAvg$new(1) + mavtest = po("regravg", innum = 1) mavtest$input$train = "Task" - expect_error(PipeOpScale$new() %>>% mavtest, + expect_error(po("scale") %>>% mavtest, "Output type of PipeOp scale during prediction \\(Task\\) incompatible with input type of PipeOp regravg \\(PredictionRegr\\)") gr = Graph$new()$ - add_pipeop(PipeOpScale$new())$ - add_pipeop(PipeOpRegrAvg$new(1)) + add_pipeop(po("scale"))$ + add_pipeop(po("regravg", innum = 1)) expect_error(gr$add_edge("scale", "regravg"), "Output type of PipeOp scale during prediction \\(Task\\) incompatible with input type of PipeOp regravg \\(PredictionRegr\\)") gr = Graph$new()$ - add_pipeop(PipeOpScale$new())$ + add_pipeop(po("scale"))$ add_pipeop(mavtest) expect_error(gr$add_edge("scale", "regravg"), "Output type of PipeOp scale during prediction \\(Task\\) incompatible with input type of PipeOp regravg \\(PredictionRegr\\)") - expect_error(PipeOpRegrAvg$new(1) %>>% PipeOpScale$new(), + expect_error(po("regravg", innum = 1) %>>% po("scale"), "Output type of PipeOp regravg during training \\(NULL\\) incompatible with input type of PipeOp scale \\(Task\\)") gr = Graph$new()$ - add_pipeop(PipeOpRegrAvg$new(1))$ - add_pipeop(PipeOpScale$new()) + add_pipeop(po("regravg", innum = 1))$ + add_pipeop(po("scale")) expect_error(gr$add_edge("regravg", "scale"), "Output type of PipeOp regravg during training \\(NULL\\) incompatible with input type of PipeOp scale \\(Task\\)") @@ -136,7 +136,7 @@ test_that("Autoconversion utility functions work", { test_that("Autoconversion for pipeops works", { - po = PipeOpCopy$new(1) + po = po("copy", outnum = 1) po$input$train = "Task" po$output$predict = "MeasureClassif" diff --git a/tests/testthat/test_usecases.R b/tests/testthat/test_usecases.R index aafb0ea65..7854dbb46 100644 --- a/tests/testthat/test_usecases.R +++ b/tests/testthat/test_usecases.R @@ -21,7 +21,7 @@ test_graph = function(g, n_nodes, n_edges) { test_that("linear: scale + pca + learn", { skip_if_not_installed("rpart") skip_if_not_installed("rpart") - g = PipeOpScale$new() %>>% PipeOpPCA$new() %>>% PipeOpLrnRP + g = po("scale") %>>% po("pca") %>>% PipeOpLrnRP z = test_graph(g, n_nodes = 3L, n_edges = 2L) expect_equal(z$g.trained$pipeops$scale$.result[[1]]$data(cols = colnames(iris)[1:4]), @@ -47,8 +47,8 @@ test_that("linear: scale + pca + learn", { test_that("featureunion", { skip_if_not_installed("rpart") - g = gunion(list(PipeOpPCA$new(), PipeOpNOP$new())) %>>% - PipeOpFeatureUnion$new(2L) %>>% PipeOpLrnRP + g = gunion(list(po("pca"), po("nop"))) %>>% + po("featureunion", innum = 2L) %>>% PipeOpLrnRP z = test_graph(g, n_nodes = 4L, n_edges = 3L) expect_equal(abs(as.matrix(z$g.trained$pipeops$pca$.result[[1]]$data(cols = paste0("PC", 1:4)))), @@ -65,7 +65,7 @@ test_that("featureunion", { test_that("bagging", { skip_if_not_installed("rpart") skip_if_not_installed("rpart") - g = pipeline_greplicate(PipeOpSubsample$new() %>>% PipeOpLrnRP, 2L) %>>% PipeOpClassifAvg$new(innum = 2L) + g = pipeline_greplicate(po("subsample") %>>% PipeOpLrnRP, 2L) %>>% po("classifavg", innum = 2L) g$pipeops$subsample_1$param_set$values$frac = .5 g$pipeops$subsample_2$param_set$values$frac = .5 z = test_graph(g, n_nodes = 5L, n_edges = 4L) @@ -86,7 +86,7 @@ test_that("branching", { # c) we need a delayed init of the pipeop, which is triggered when the pipeop is # connected. this would help a lot when we connect the PipeOp to its neighbor and # need some info from the nieghbor to decide some poperties of the PO - g = PipeOpBranch$new(2L) %>>% gunion(list(PipeOpLrnRP, PipeOpLrnFL)) %>>% PipeOpUnbranch$new(2L) + g = po("branch", options = 2L) %>>% gunion(list(PipeOpLrnRP, PipeOpLrnFL)) %>>% po("unbranch", options = 2L) z = test_graph(g, n_nodes = 4L, n_edges = 4L) expect_equal(z$g.trained$pipeops$classif.rpart$.result, list(output = NULL)) @@ -96,7 +96,7 @@ test_that("branching", { expect_equal(z$g.predicted$pipeops$classif.rpart$.result[[1]], z$g.predicted$pipeops$unbranch$.result[[1]]) expect_equal(z$g.predicted$pipeops$classif.featureless$.result, list(output = NO_OP)) - g = PipeOpBranch$new(2L) %>>% gunion(list(PipeOpLrnRP, PipeOpLrnFL)) %>>% PipeOpUnbranch$new(2L) + g = po("branch", options = 2L) %>>% gunion(list(PipeOpLrnRP, PipeOpLrnFL)) %>>% po("unbranch", options = 2L) task = mlr_tasks$get("iris") res = g$train(task) expect_true(g$is_trained) @@ -109,7 +109,7 @@ test_that("branching", { test_that("branching with varargs", { skip_if_not_installed("rpart") skip_if_not_installed("rpart") - g = PipeOpBranch$new(2L) %>>% gunion(list(PipeOpLrnRP, PipeOpLrnFL)) %>>% PipeOpUnbranch$new() + g = po("branch", options = 2L) %>>% gunion(list(PipeOpLrnRP, PipeOpLrnFL)) %>>% po("unbranch") z = test_graph(g, n_nodes = 4L, n_edges = 4L) expect_equal(z$g.trained$pipeops$classif.rpart$.result, list(output = NULL)) @@ -119,7 +119,7 @@ test_that("branching with varargs", { expect_equal(z$g.predicted$pipeops$classif.rpart$.result[[1]], z$g.predicted$pipeops$unbranch$.result[[1]]) expect_equal(z$g.predicted$pipeops$classif.featureless$.result, list(output = NO_OP)) - g = PipeOpBranch$new(2L) %>>% gunion(list(PipeOpLrnRP, PipeOpLrnFL)) %>>% PipeOpUnbranch$new() + g = po("branch", options = 2L) %>>% gunion(list(PipeOpLrnRP, PipeOpLrnFL)) %>>% po("unbranch") task = mlr_tasks$get("iris") res = g$train(task) expect_true(g$is_trained) @@ -133,7 +133,7 @@ test_that("branching with varargs", { test_that("task chunking", { skip_if_not_installed("rpart") - g = PipeOpChunk$new(2L) %>>% pipeline_greplicate(PipeOpLrnRP, 2L) %>>% PipeOpClassifAvg$new(2L) + g = po("chunk", outnum = 2L) %>>% pipeline_greplicate(PipeOpLrnRP, 2L) %>>% po("classifavg", innum = 2L) z = test_graph(g, n_nodes = 4L, n_edges = 4L) }) @@ -145,10 +145,10 @@ test_that("stacking", { lrn1 = mlr_learners$get("classif.rpart") lrn2 = mlr_learners$get("classif.featureless") pipe = gunion(list( - PipeOpLearnerCV$new(lrn1), - PipeOpLearnerCV$new(lrn2), - PipeOpNOP$new())) - pipe = pipe %>>% PipeOpFeatureUnion$new(3) + po("learner_cv", lrn1), + po("learner_cv", lrn2), + po("nop"))) + pipe = pipe %>>% po("featureunion", innum = 3) result = pipe$train(task)[[1]] From 543b779803fbbf51765b9cb1b1066e934e3bbb57 Mon Sep 17 00:00:00 2001 From: mb706 Date: Wed, 13 Aug 2025 22:49:01 +0200 Subject: [PATCH 03/31] using po() syntax in tests II --- R/GraphLearner.R | 5 +- R/PipeOpLearner.R | 3 +- tests/testthat/test_pipeop_collapsefactors.R | 2 +- tests/testthat/test_pipeop_copy.R | 4 +- tests/testthat/test_pipeop_decode.R | 8 +-- tests/testthat/test_pipeop_encode.R | 10 +-- tests/testthat/test_pipeop_encodeimpact.R | 6 +- tests/testthat/test_pipeop_ensemble.R | 16 ++--- tests/testthat/test_pipeop_featureunion.R | 64 ++++++++++---------- tests/testthat/test_pipeop_filter.R | 4 +- tests/testthat/test_pipeop_fixfactors.R | 2 +- tests/testthat/test_pipeop_histbin.R | 8 +-- tests/testthat/test_pipeop_kernelpca.R | 6 +- tests/testthat/test_pipeop_missind.R | 2 +- tests/testthat/test_pipeop_nmf.R | 4 +- tests/testthat/test_pipeop_removeconstants.R | 4 +- 16 files changed, 77 insertions(+), 71 deletions(-) diff --git a/R/GraphLearner.R b/R/GraphLearner.R index 4e5a86952..c0a488b68 100644 --- a/R/GraphLearner.R +++ b/R/GraphLearner.R @@ -185,6 +185,9 @@ GraphLearner = R6Class("GraphLearner", inherit = Learner, graph$state = NULL id = assert_string(id, null.ok = TRUE) %??% paste(graph$ids(sorted = TRUE), collapse = ".") + if (".has_id" %in% names(private)) { + private$.has_id = TRUE + } self$id = id # init early so 'base_learner()' can use it in error messages private$.graph = graph @@ -216,7 +219,7 @@ GraphLearner = R6Class("GraphLearner", inherit = Learner, intersect(c("importance", "oob_error", "loglik"), blproperties) ) - super$initialize(id = id, dict_entry = NULL, task_type = task_type, + super$initialize(id = id, task_type = task_type, param_set = alist(private$.graph$param_set), feature_types = mlr_reflections$task_feature_types, predict_types = names(mlr_reflections$learner_predict_types[[task_type]]), diff --git a/R/PipeOpLearner.R b/R/PipeOpLearner.R index 6cafc10ae..81165678a 100644 --- a/R/PipeOpLearner.R +++ b/R/PipeOpLearner.R @@ -108,7 +108,8 @@ PipeOpLearner = R6Class("PipeOpLearner", inherit = PipeOp, out_type = mlr_reflections$task_types[type, mult = "first"]$prediction properties = c("validation", "internal_tuning") properties = properties[properties %in% private$.learner$properties] - super$initialize(id = "learner", param_set = alist(private$.learner$param_set), param_vals = param_vals, + super$initialize(id = id, dict_entry = "learner", + param_set = alist(private$.learner$param_set), param_vals = param_vals, input = data.table(name = "input", train = task_type, predict = task_type), output = data.table(name = "output", train = "NULL", predict = out_type), tags = "learner", packages = learner$packages, properties = properties diff --git a/tests/testthat/test_pipeop_collapsefactors.R b/tests/testthat/test_pipeop_collapsefactors.R index d7a75b1ae..dee1eb9d2 100644 --- a/tests/testthat/test_pipeop_collapsefactors.R +++ b/tests/testthat/test_pipeop_collapsefactors.R @@ -7,7 +7,7 @@ test_that("PipeOpCollapseFactors - basic properties", { }) test_that("PipeOpCollapseFactors - train and predict work", { - op = PipeOpCollapseFactors$new() + op = po("collapsefactors") df = data.frame( target = runif(100), fct = factor(rep(LETTERS[1:6], times = c(25, 30, 5, 15, 5, 20))), diff --git a/tests/testthat/test_pipeop_copy.R b/tests/testthat/test_pipeop_copy.R index d16fff61b..1f610b84d 100644 --- a/tests/testthat/test_pipeop_copy.R +++ b/tests/testthat/test_pipeop_copy.R @@ -6,7 +6,7 @@ test_that("PipeOpCopy - basic properties", { expect_pipeop_class(PipeOpCopy, list(3)) expect_error(PipeOpCopy$new(0)) - po = PipeOpCopy$new(3) + po = po("copy", outnum = 3) expect_pipeop(po) expect_data_table(po$input, nrows = 1) expect_data_table(po$output, nrows = 3) @@ -14,7 +14,7 @@ test_that("PipeOpCopy - basic properties", { test_that("PipeOpCopy - train and predict", { - copy = PipeOpCopy$new(2) + copy = po("copy", outnum = 2) task = mlr_tasks$get("iris") tout = train_pipeop(copy, list(task)) diff --git a/tests/testthat/test_pipeop_decode.R b/tests/testthat/test_pipeop_decode.R index bea1591a1..f340818b0 100644 --- a/tests/testthat/test_pipeop_decode.R +++ b/tests/testthat/test_pipeop_decode.R @@ -15,7 +15,7 @@ test_that("PipeOpDecode - basic properties", { }) test_that("PipeOpDecode - one-hot-encoding", { - op = PipeOpDecode$new() + op = po("decode") dt = data.table( target = runif(10), @@ -95,7 +95,7 @@ test_that("PipeOpDecode - one-hot-encoding", { }) test_that("PipeOpDecode - treatment encoding", { - op = PipeOpDecode$new() + op = po("decode") op$param_set$values$treatment_encoding = TRUE dt = data.table( @@ -144,7 +144,7 @@ test_that("PipeOpDecode - treatment encoding", { }) test_that("PipOpDecode - collapse all into one", { - op = PipeOpDecode$new() + op = po("decode") op$param_set$values$group_pattern = "" dt = data.table( @@ -164,7 +164,7 @@ test_that("PipOpDecode - collapse all into one", { }) test_that("PipeOpDecode - errors", { - op = PipeOpDecode$new() + op = po("decode") dt = data.table( target = runif(20), x.1 = rep(c(1, 0), 10), diff --git a/tests/testthat/test_pipeop_encode.R b/tests/testthat/test_pipeop_encode.R index d8cb5764c..aa5b62f85 100644 --- a/tests/testthat/test_pipeop_encode.R +++ b/tests/testthat/test_pipeop_encode.R @@ -24,7 +24,7 @@ test_that("PipeOpEncode", { expect_datapreproc_pipeop_class(PipeOpEncode, task = mlr_tasks$get("iris")) - op = PipeOpEncode$new() + op = po("encode") expect_pipeop(op) nt = train_pipeop(op, inputs = list(task))[[1L]] @@ -60,7 +60,7 @@ test_that("PipeOpEncode", { # repeat with method == reference - op = PipeOpEncode$new() + op = po("encode") op$param_set$values = list(method = "treatment") nt = train_pipeop(op, inputs = list(task))[[1L]] fn = nt$feature_names @@ -78,7 +78,7 @@ test_that("PipeOpEncode", { expect_true(all(make.names(sprintf("town.%s", tail(townlevels, -1L)), unique = TRUE) %in% fn)) expect_true(all(make.names(sprintf("town.%s", head(townlevels, 1L)), unique = TRUE) %nin% fn)) - op = PipeOpEncode$new() + op = po("encode") op$param_set$values$method = "helmert" nt = train_pipeop(op, inputs = list(task))[[1L]] @@ -91,7 +91,7 @@ test_that("PipeOpEncode", { check_dat(op$train(list(natask))[[1]]$data()) check_dat(op$predict(list(natask))[[1]]$data()) - op = PipeOpEncode$new() + op = po("encode") op$param_set$values$method = "sum" nt = train_pipeop(op, inputs = list(task))[[1L]] @@ -104,7 +104,7 @@ test_that("PipeOpEncode", { check_dat(op$train(list(natask))[[1]]$data()) check_dat(op$predict(list(natask))[[1]]$data()) - op = PipeOpEncode$new() + op = po("encode") op$param_set$values$method = "poly" nt = train_pipeop(op, inputs = list(task))[[1L]] diff --git a/tests/testthat/test_pipeop_encodeimpact.R b/tests/testthat/test_pipeop_encodeimpact.R index 3a6adc9cf..c504f065b 100644 --- a/tests/testthat/test_pipeop_encodeimpact.R +++ b/tests/testthat/test_pipeop_encodeimpact.R @@ -14,7 +14,7 @@ test_that("PipeOpEncodeImpact", { expect_datapreproc_pipeop_class(PipeOpEncodeImpact, task = mlr_tasks$get("iris")) - op = PipeOpEncodeImpact$new() + op = po("encodeimpact") nt = train_pipeop(op, inputs = list(task))[[1L]] fn = nt$feature_names @@ -41,7 +41,7 @@ test_that("PipeOpImpactEncode on Classification", { testtask = TaskClassif$new("test", testdf, "t") - op = PipeOpEncodeImpact$new() + op = po("encodeimpact") expect_equal(op$train(list(tsk("iris")))[[1]], tsk("iris")) @@ -116,7 +116,7 @@ test_that("PipeOpImpactEncode on Regression", { b = c(-1, 2, 2, -1, -1, -1) / 4, t = c(1, 2, 3, 1, 2, 3)) - op = PipeOpEncodeImpact$new() + op = po("encodeimpact") op$param_set$values$smoothing = 0 expect_equal(op$train(list(testtask))[[1]]$data(), expect, ignore.col.order = TRUE) diff --git a/tests/testthat/test_pipeop_ensemble.R b/tests/testthat/test_pipeop_ensemble.R index f0b9ad237..82334ffbf 100644 --- a/tests/testthat/test_pipeop_ensemble.R +++ b/tests/testthat/test_pipeop_ensemble.R @@ -29,26 +29,26 @@ test_that("PipeOpWeightedRegrAvg - train and predict", { truth = rnorm(70) prds = replicate(4, PredictionRegr$new(row_ids = seq_len(70), truth = truth, response = truth + rnorm(70, sd = 0.1)), simplify = FALSE) - po = PipeOpRegrAvg$new(4) + po = po("regravg", innum = 4) expect_pipeop(po) expect_list(train_pipeop(po, rep(list(NULL), 4)), len = 1) out = predict_pipeop(po, prds) # Returns the same if weights are 1, rest 0 - po = PipeOpRegrAvg$new(4) + po = po("regravg", innum = 4) po$param_set$values$weights = c(0, 0, 1, 0) expect_list(train_pipeop(po, rep(list(NULL), 4)), len = 1) out = predict_pipeop(po, prds) expect_equal(out, list(output = prds[[3]])) - po = PipeOpRegrAvg$new() + po = po("regravg") expect_pipeop(po) expect_list(train_pipeop(po, rep(list(NULL), 4)), len = 1) out = predict_pipeop(po, prds) # Returns the same if weights are 1, rest 0 - po = PipeOpRegrAvg$new() + po = po("regravg") po$param_set$values$weights = c(0, 0, 1, 0) expect_list(train_pipeop(po, rep(list(NULL), 4)), len = 1) out = predict_pipeop(po, prds) @@ -75,26 +75,26 @@ test_that("PipeOpWeightedClassifAvg - response - train and predict", { simplify = FALSE ) lapply(prds, function(x) x$data$tab$truth = prds[[1]]$data$tab$truth) # works because of R6 reference semantics - po = PipeOpClassifAvg$new(4) + po = po("classifavg", innum = 4) expect_pipeop(po) expect_list(train_pipeop(po, nulls), len = 1) out = predict_pipeop(po, prds) expect_class(out[[1]], "PredictionClassif") - po = PipeOpClassifAvg$new(4) + po = po("classifavg", innum = 4) po$param_set$values$weights = c(0, 0, 0, 1) expect_list(train_pipeop(po, nulls), len = 1) out = predict_pipeop(po, prds) expect_class(out[[1]], "PredictionClassif") expect_equal(out[[1]]$data$tab, prds[[4]]$data$tab) - po = PipeOpClassifAvg$new() + po = po("classifavg") expect_pipeop(po) expect_list(train_pipeop(po, nulls), len = 1) out = predict_pipeop(po, prds) expect_class(out[[1]], "PredictionClassif") - po = PipeOpClassifAvg$new() + po = po("classifavg") po$param_set$values$weights = c(0, 0, 0, 1) expect_list(train_pipeop(po, nulls), len = 1) out = predict_pipeop(po, prds) diff --git a/tests/testthat/test_pipeop_featureunion.R b/tests/testthat/test_pipeop_featureunion.R index 50348a091..de6e05fd4 100644 --- a/tests/testthat/test_pipeop_featureunion.R +++ b/tests/testthat/test_pipeop_featureunion.R @@ -1,7 +1,7 @@ context("PipeOpFeatureUnion") test_that("featureunion - basic properties", { - po = PipeOpFeatureUnion$new(3) + po = po("featureunion", innum = 3) expect_pipeop(po) expect_data_table(po$input, nrows = 3) expect_data_table(po$output, nrows = 1) @@ -9,12 +9,12 @@ test_that("featureunion - basic properties", { expect_pipeop_class(PipeOpFeatureUnion, list(1)) expect_pipeop_class(PipeOpFeatureUnion, list(3)) - po = PipeOpFeatureUnion$new() + po = po("featureunion") expect_pipeop(po) expect_data_table(po$input, nrows = 1) expect_data_table(po$output, nrows = 1) - expect_error(PipeOpFeatureUnion$new(1, collect_multiplicity = TRUE), regexp = "collect_multiplicity only works with innum == 0") + expect_error(po("featureunion", innum = 1, collect_multiplicity = TRUE), regexp = "collect_multiplicity only works with innum == 0") }) test_that("PipeOpFeatureUnion - train and predict", { @@ -27,7 +27,7 @@ test_that("PipeOpFeatureUnion - train and predict", { expect_task(cbind_tasks(inputs = list(t1, t2), TRUE, c("", ""))) - po = PipeOpFeatureUnion$new(2) + po = po("featureunion", innum = 2) tout = train_pipeop(po, list(t1, t2)) expect_equivalent(tout[[1]]$feature_names, tsk$feature_names) @@ -37,7 +37,7 @@ test_that("PipeOpFeatureUnion - train and predict", { expect_equivalent(pout[[1]]$feature_names, tsk$feature_names) expect_equivalent(pout[[1]]$target_names, tsk$target_names) - po = PipeOpFeatureUnion$new() + po = po("featureunion") tout = train_pipeop(po, list(t1, t2)) expect_equivalent(tout[[1]]$feature_names, tsk$feature_names) @@ -51,15 +51,15 @@ test_that("PipeOpFeatureUnion - train and predict", { test_that("PipeOpFeatureUnion - train and predict II", { skip_if_not_installed("rpart") # Define PipeOp's - scatter = PipeOpCopy$new(2) - op2a = PipeOpPCA$new() - op2b = PipeOpNOP$new() - op3 = PipeOpFeatureUnion$new(2) - opdot = PipeOpFeatureUnion$new() + scatter = po("copy", outnum = 2) + op2a = po("pca") + op2b = po("nop") + op3 = po("featureunion", innum = 2) + opdot = po("featureunion") task = mlr_tasks$get("iris") lrn = mlr_learners$get("classif.rpart") - op4 = PipeOpLearner$new(learner = lrn) + op4 = po("learner", lrn) # FIXME: Check param_set param_names_union = c( @@ -96,18 +96,18 @@ test_that("PipeOpFeatureUnion - train and predict II", { test_that("Test wrong inputs", { # Differing rows - pos = PipeOpSubsample$new() + pos = po("subsample") pos$param_set$values$frac = 0.5 g = pipeline_greplicate( - pos %>>% PipeOpPCA$new(), + pos %>>% po("pca"), 2 - ) %>>% PipeOpFeatureUnion$new(c("a", "b")) + ) %>>% po("featureunion", innum = c("a", "b")) task = mlr_tasks$get("iris") # TODO: the following was broken by mlr3 recently # expect_error(g$train(task), "Assertion on 'rows'") # Differing target columns - po = PipeOpFeatureUnion$new() + po = po("featureunion") expect_error(po$train(list(tsk("iris"), tsk("mtcars")), regexp = "All tasks must have the same target columns")) }) @@ -121,7 +121,7 @@ test_that("PipeOpFeatureUnion - levels are preserved", { tsk1$col_info tsk2$col_info - pofu = PipeOpFeatureUnion$new(2) + pofu = po("featureunion", innum = 2) expect_true(!pofu$is_trained) pofu$train(list(tsk1, tsk2))[[1]]$col_info expect_true(pofu$is_trained) @@ -133,30 +133,30 @@ test_that("feature renaming", { skip_if_not_installed("rpart") expect_pipeop_class(PipeOpFeatureUnion, list(letters[1:3])) - expect_equal(nrow(PipeOpFeatureUnion$new(c("a", "b", "c"))$input), 3) - expect_equal(nrow(PipeOpFeatureUnion$new("a")$input), 1) + expect_equal(nrow(po("featureunion", innum = c("a", "b", "c"))$input), 3) + expect_equal(nrow(po("featureunion", innum = "a")$input), 1) - po = PipeOpFeatureUnion$new(c("", "a", "b")) + po = po("featureunion", innum = c("", "a", "b")) task = mlr_tasks$get("iris") expect_equal(po$train(list(task, task, task))[[1]]$feature_names, c(task$feature_names, paste0("a.", task$feature_names), paste0("b.", task$feature_names))) - po = PipeOpFeatureUnion$new(c("", "a", "a")) + po = po("featureunion", innum = c("", "a", "a")) - expect_equal(po$train(list(task, task, PipeOpPCA$new()$train(list(task))[[1]]))[[1]]$feature_names, + expect_equal(po$train(list(task, task, po("pca")$train(list(task))[[1]]))[[1]]$feature_names, c(task$feature_names, paste0("a.", task$feature_names), paste0("a.PC", 1:4))) # Define PipeOp's - scatter = PipeOpCopy$new(2) - op2a = PipeOpPCA$new() - op2b = PipeOpNOP$new() - op3 = PipeOpFeatureUnion$new(c("", "XX")) + scatter = po("copy", outnum = 2) + op2a = po("pca") + op2b = po("nop") + op3 = po("featureunion", innum = c("", "XX")) task = mlr_tasks$get("iris") lrn = mlr_learners$get("classif.rpart") - op4 = PipeOpLearner$new(learner = lrn) + op4 = po("learner", lrn) # FIXME: Check param_set param_names_union = c( @@ -177,9 +177,9 @@ test_that("feature renaming", { "XX.Petal.Width", "XX.Sepal.Length", "XX.Sepal.Width")) expect_true(graph$is_trained) - po = PipeOpFeatureUnion$new(c("z", "a", "a")) + po = po("featureunion", innum = c("z", "a", "a")) - expect_equal(po$train(list(task, task, PipeOpPCA$new()$train(list(task))[[1]]))[[1]]$feature_names, + expect_equal(po$train(list(task, task, po("pca")$train(list(task))[[1]]))[[1]]$feature_names, c(task$feature_names, paste0("a.", task$feature_names), paste0("a.PC", 1:4))) }) @@ -204,12 +204,12 @@ test_that("feature renaming", { test_that("featureunion - duplicates in feature names", { tsk = mlr_tasks$get("iris") - g = pipeline_greplicate(PipeOpPCA$new(), 2) %>>% PipeOpFeatureUnion$new(2) + g = pipeline_greplicate(po("pca"), 2) %>>% po("featureunion", innum = 2) # this should work (just keeps each PC a single time) train_out_g = g$train(tsk) - popca = PipeOpPCA$new() + popca = po("pca") train_out_pca = popca$train(list(tsk)) expect_equal(train_out_g[[1]]$data(), train_out_pca[[1]]$data()) @@ -219,12 +219,12 @@ test_that("featureunion - duplicates in feature names", { dat$Sepal.Width[1] = 999 tsk2 = TaskClassif$new("tsk2", backend = dat, target = "Species") - po = PipeOpFeatureUnion$new() + po = po("featureunion") expect_error(po$train(list(tsk, tsk2)), regexp = "different features sharing the same feature name") }) test_that("featureunion - collect_multiplicity", { - po = PipeOpFeatureUnion$new(0, collect_multiplicity = TRUE) + po = po("featureunion", innum = 0, collect_multiplicity = TRUE) expect_pipeop(po) expect_data_table(po$input, nrows = 1) expect_data_table(po$output, nrows = 1) diff --git a/tests/testthat/test_pipeop_filter.R b/tests/testthat/test_pipeop_filter.R index b4ecee96a..c41ca68b9 100644 --- a/tests/testthat/test_pipeop_filter.R +++ b/tests/testthat/test_pipeop_filter.R @@ -12,7 +12,7 @@ test_that("PipeOpFilter", { list(filter = mlr3filters::FilterVariance$new(), param_vals = list(filter.frac = 0.5)), task = mlr_tasks$get("iris"), check_ps_default_values = FALSE) - po = PipeOpFilter$new(mlr3filters::FilterVariance$new()) + po = po("filter", filter = mlr3filters::FilterVariance$new()) expect_equal(po$id, mlr3filters::FilterVariance$new()$id) @@ -49,7 +49,7 @@ test_that("PipeOpFilter", { test_that("PipeOpFilter parameters", { skip_if_not_installed("mlr3filters") - po = PipeOpFilter$new(mlr3filters::FilterVariance$new()) + po = po("filter", filter = mlr3filters::FilterVariance$new()) expect_set_equal(c("filter.nfeat", "filter.frac", "filter.cutoff", "filter.permuted"), grep("^filter\\.", po$param_set$ids(), value = TRUE)) diff --git a/tests/testthat/test_pipeop_fixfactors.R b/tests/testthat/test_pipeop_fixfactors.R index 75320be41..b7f1083f1 100644 --- a/tests/testthat/test_pipeop_fixfactors.R +++ b/tests/testthat/test_pipeop_fixfactors.R @@ -10,7 +10,7 @@ test_that("PipeOpFixFactors", { expect_datapreproc_pipeop_class(PipeOpFixFactors, task = mlr_tasks$get("iris")) - op = PipeOpFixFactors$new() + op = po("fixfactors") nt = train_pipeop(op, inputs = list(task))[[1L]] fn = nt$feature_names diff --git a/tests/testthat/test_pipeop_histbin.R b/tests/testthat/test_pipeop_histbin.R index 41c61cdf7..17bcce140 100644 --- a/tests/testthat/test_pipeop_histbin.R +++ b/tests/testthat/test_pipeop_histbin.R @@ -2,7 +2,7 @@ context("PipeOpHistBin") test_that("PipeOpHistBin - basic properties", { task = mlr_tasks$get("iris") - op = PipeOpHistBin$new() + op = po("histbin") expect_datapreproc_pipeop_class(PipeOpHistBin, task = task) @@ -14,7 +14,7 @@ test_that("PipeOpHistBin - basic properties", { test_that("PipeOpHistBin - change breaks", { task = mlr_tasks$get("iris") # 5 breaks --> 7 groups - op5 = PipeOpHistBin$new(param_vals = list(breaks = 5L)) + op5 = po("histbin", breaks = 5L) expect_pipeop(op5) result = op5$train(list(task)) b = apply(result[[1L]]$data(cols = result[[1L]]$feature_names), MARGIN = 2L, @@ -28,7 +28,7 @@ test_that("PipeOpHistBin - numerics out of range of training data", { dat$Sepal.Width[1L] = 5 task2 = TaskClassif$new("iris2", backend = dat, target = "Species") - op = PipeOpHistBin$new() + op = po("histbin") result1 = op$train(list(task1)) ranges = sapply(op$state$breaks, FUN = range) expect_equal(ranges[1L, ], rep.int(-Inf, times = 4L)) @@ -50,7 +50,7 @@ test_that("PipeOpHistBin - not all bins present", { dat$Sepal.Width[[1L]] = 2.13 task2 = TaskClassif$new("iris2", backend = dat, target = "Species") - op = PipeOpHistBin$new(param_vals = list(breaks = seq(0, 10, by = 0.05))) + op = po("histbin", breaks = seq(0, 10, by = 0.05)) expect_pipeop(op) # task1 does not have a Sepal.Width value within the interval (2.10, 2.15] diff --git a/tests/testthat/test_pipeop_kernelpca.R b/tests/testthat/test_pipeop_kernelpca.R index 4f7f7420b..7d387b160 100644 --- a/tests/testthat/test_pipeop_kernelpca.R +++ b/tests/testthat/test_pipeop_kernelpca.R @@ -9,7 +9,7 @@ test_that("PipeOpKernelPCA - basic properties", { expect_datapreproc_pipeop_class(PipeOpKernelPCA, task = task, deterministic_train = TRUE, deterministic_predict = TRUE, tolerance = 1e-4) - op = PipeOpKernelPCA$new() + op = po("kernelpca") expect_pipeop(op) set.seed(1234) result = op$train(list(task)) @@ -22,7 +22,7 @@ test_that("PipeOpKernelPCA - compare to kernlab::kpca", { skip_if_not_installed("kernlab") task = mlr_tasks$get("iris") - op = PipeOpKernelPCA$new() + op = po("kernelpca") expect_pipeop(op) set.seed(1234) result = op$train(list(task)) @@ -35,7 +35,7 @@ test_that("PipeOpKernelPCA - compare to kernlab::kpca", { expect_equal(result[[1]]$data()[, -1], as.data.table(kernlab::rotated(pca))) # Change some parameters - op2 = PipeOpKernelPCA$new(param_vals = list(kpar = list(sigma = 0.4), features = 4)) + op2 = po("kernelpca", kpar = list(sigma = 0.4), features = 4) expect_pipeop(op2) set.seed(1234) result2 = op2$train(list(task)) diff --git a/tests/testthat/test_pipeop_missind.R b/tests/testthat/test_pipeop_missind.R index 43c467334..31425ad55 100644 --- a/tests/testthat/test_pipeop_missind.R +++ b/tests/testthat/test_pipeop_missind.R @@ -42,7 +42,7 @@ test_that("PipeOpMissInd", { expect_datapreproc_pipeop_class(PipeOpMissInd, task = task, constargs = list(param_vals = list(which = "all", type = "numeric", affect_columns = NULL))) - po = PipeOpMissInd$new(param_vals = list(which = "all", type = "logical", affect_columns = NULL)) + po = po("missind", which = "all", type = "logical", affect_columns = NULL) task_trained = po$train(list(task$clone(deep = TRUE)$filter(5:6)))[[1]]$data() diff --git a/tests/testthat/test_pipeop_nmf.R b/tests/testthat/test_pipeop_nmf.R index 1d2828190..a46ba3efb 100644 --- a/tests/testthat/test_pipeop_nmf.R +++ b/tests/testthat/test_pipeop_nmf.R @@ -8,7 +8,7 @@ test_that("basic properties", { test_that("feature selector", { skip_if_not_installed("NMF") - op = PipeOpNMF$new() + op = po("nmf") dat = iris dat$Sepal.Length[1L] <- -999 dat$test <- rep.int(c(TRUE, FALSE), times = 75L) @@ -20,7 +20,7 @@ test_that("feature selector", { test_that("parameters", { skip_if_not_installed("NMF") - op = PipeOpNMF$new() + op = po("nmf") op$param_set$values$rank = 3L op$param_set$values$nrun = 2L op$param_set$values$seed = 999 diff --git a/tests/testthat/test_pipeop_removeconstants.R b/tests/testthat/test_pipeop_removeconstants.R index 38bc25f79..4665ff87a 100644 --- a/tests/testthat/test_pipeop_removeconstants.R +++ b/tests/testthat/test_pipeop_removeconstants.R @@ -38,7 +38,9 @@ test_that("PipeOpRemoveConstants removes expected cols", { test_dropping = function(data, expected_data, params) { intask = TaskClassif$new("iris", cbind(data, target = factor(c("x", rep("y", nrow(data) - 1)))), "target") - resulttask = po("removeconstants", !!!params)$train(list(intask))[[1]] + porc = po("removeconstants") + porc$param_set$set_values(.values = params) + resulttask = porc$train(list(intask))[[1]] expect_equal(resulttask$data(cols = resulttask$feature_names), as.data.table(expected_data), ignore.col.order = TRUE) } From 2ca04de1f176f27fd15134f3e5cee1db8e09044d Mon Sep 17 00:00:00 2001 From: mb706 Date: Wed, 13 Aug 2025 23:12:52 +0200 Subject: [PATCH 04/31] using po() syntax in tests III --- inst/testthat/helper_functions.R | 10 +++-- tests/testthat/test_pipeop_colapply.R | 4 +- tests/testthat/test_pipeop_ensemble.R | 6 +-- tests/testthat/test_pipeop_filter.R | 8 ++-- tests/testthat/test_pipeop_impute.R | 48 ++++++++++++------------ tests/testthat/test_pipeop_learnercv.R | 2 +- tests/testthat/test_pipeop_missind.R | 10 ++--- tests/testthat/test_pipeop_modelmatrix.R | 8 ++-- tests/testthat/test_pipeop_proxy.R | 2 +- tests/testthat/test_pipeop_scale.R | 2 +- tests/testthat/test_pipeop_select.R | 2 +- 11 files changed, 52 insertions(+), 50 deletions(-) diff --git a/inst/testthat/helper_functions.R b/inst/testthat/helper_functions.R index 9e3a55777..163288287 100644 --- a/inst/testthat/helper_functions.R +++ b/inst/testthat/helper_functions.R @@ -155,9 +155,10 @@ expect_valid_pipeop_param_set = function(po, check_ps_default_values = TRUE) { # - deep clone works # - *_internal checks for classes # - *_internal handles NO_OP as it should -expect_pipeop_class = function(poclass, constargs = list(), check_ps_default_values = TRUE) { +expect_pipeop_class = function(poclass, constargs = list(), param_vals = list(), check_ps_default_values = TRUE) { skip_on_cran() po = do.call(poclass$new, constargs) + po$param_set$set_values(.values = param_vals) expect_pipeop(po, check_ps_default_values = check_ps_default_values) @@ -209,7 +210,7 @@ expect_pipeop_class = function(poclass, constargs = list(), check_ps_default_val # - preproc() gives no error with data.table indata if PipeOp works without target column # # `task` must have at least two feature columns and at least two rows. -expect_datapreproc_pipeop_class = function(poclass, constargs = list(), task, +expect_datapreproc_pipeop_class = function(poclass, constargs = list(), param_vals = list(), task, predict_like_train = TRUE, predict_rows_independent = TRUE, deterministic_train = TRUE, deterministic_predict = TRUE, affect_context_independent = TRUE, # whether excluding a column does not change what happens to the other columns @@ -222,10 +223,12 @@ expect_datapreproc_pipeop_class = function(poclass, constargs = list(), task, original_clone = task$clone(deep = TRUE) expect_shallow_clone(task, original_clone) - expect_pipeop_class(poclass, constargs, check_ps_default_values = check_ps_default_values) + expect_pipeop_class(poclass, constargs, param_vals = param_vals, check_ps_default_values = check_ps_default_values) po = do.call(poclass$new, constargs) + po$param_set$set_values(.values = param_vals) po2 = do.call(poclass$new, constargs) + po2$param_set$set_values(.values = param_vals) expect_equal(po$innum, 1) expect_equal(po$outnum, 1) @@ -437,6 +440,7 @@ expect_datapreproc_pipeop_class = function(poclass, constargs = list(), task, # test that predict on test rows during train is the same as predict on the rows po = do.call(poclass$new, constargs) + po$param_set$set_values(.values = param_vals) tasktrain = original_clone$clone(deep = TRUE) n_use = length(tasktrain$row_roles$use) diff --git a/tests/testthat/test_pipeop_colapply.R b/tests/testthat/test_pipeop_colapply.R index 1d8f2e4ee..af2affc96 100644 --- a/tests/testthat/test_pipeop_colapply.R +++ b/tests/testthat/test_pipeop_colapply.R @@ -7,10 +7,10 @@ test_that("apply general tests", { task = mlr_tasks$get("iris") expect_datapreproc_pipeop_class(PipeOpColApply, task = task, - constargs = list(param_vals = list(applicator = as.character))) + constargs = list(), param_vals = list(applicator = as.character)) expect_datapreproc_pipeop_class(PipeOpColApply, task = mlr_tasks$get("pima"), - constargs = list(param_vals = list(applicator = as.numeric))) + constargs = list(), param_vals = list(applicator = as.numeric)) }) diff --git a/tests/testthat/test_pipeop_ensemble.R b/tests/testthat/test_pipeop_ensemble.R index 82334ffbf..45272fd08 100644 --- a/tests/testthat/test_pipeop_ensemble.R +++ b/tests/testthat/test_pipeop_ensemble.R @@ -3,9 +3,9 @@ context("PipeOpEnsemble") test_that("PipeOpEnsemble - basic properties", { op = PipeOpEnsemble$new(4, id = "ensemble", param_vals = list()) expect_pipeop(op) - expect_pipeop_class(PipeOpEnsemble, list(3, id = "ensemble", param_vals = list())) - expect_pipeop_class(PipeOpEnsemble, list(1, id = "ensemble", param_vals = list())) - expect_pipeop_class(PipeOpEnsemble, list(0, id = "ensemble", param_vals = list())) + expect_pipeop_class(PipeOpEnsemble, list(3, id = "ensemble"), param_vals = list()) + expect_pipeop_class(PipeOpEnsemble, list(1, id = "ensemble"), param_vals = list()) + expect_pipeop_class(PipeOpEnsemble, list(0, id = "ensemble"), param_vals = list()) truth = rnorm(70) prds = replicate(4, PredictionRegr$new(row_ids = seq_len(70), truth = truth, response = truth + rnorm(70, sd = 0.1))) diff --git a/tests/testthat/test_pipeop_filter.R b/tests/testthat/test_pipeop_filter.R index c41ca68b9..cf3585122 100644 --- a/tests/testthat/test_pipeop_filter.R +++ b/tests/testthat/test_pipeop_filter.R @@ -5,12 +5,12 @@ test_that("PipeOpFilter", { task = mlr_tasks$get("boston_housing_classic") expect_datapreproc_pipeop_class(PipeOpFilter, - list(filter = mlr3filters::FilterVariance$new(), param_vals = list(filter.frac = 0.5)), task = task, - check_ps_default_values = FALSE) + list(filter = mlr3filters::FilterVariance$new()), task = task, + check_ps_default_values = FALSE, param_vals = list(filter.frac = 0.5)) expect_datapreproc_pipeop_class(PipeOpFilter, - list(filter = mlr3filters::FilterVariance$new(), param_vals = list(filter.frac = 0.5)), task = mlr_tasks$get("iris"), - check_ps_default_values = FALSE) + list(filter = mlr3filters::FilterVariance$new()), task = mlr_tasks$get("iris"), + check_ps_default_values = FALSE, param_vals = list(filter.frac = 0.5)) po = po("filter", filter = mlr3filters::FilterVariance$new()) diff --git a/tests/testthat/test_pipeop_impute.R b/tests/testthat/test_pipeop_impute.R index 5973f1496..5084dd47b 100644 --- a/tests/testthat/test_pipeop_impute.R +++ b/tests/testthat/test_pipeop_impute.R @@ -79,9 +79,9 @@ test_that("PipeOpImpute", { task = mlr_tasks$get("pima") - expect_datapreproc_pipeop_class(PipeOpTestImpute, constargs = list(param_vals = list(innum = c("a", "b", "c", "d", "e"))), task = task) + expect_datapreproc_pipeop_class(PipeOpTestImpute, constargs = list(), param_vals = list(innum = c("a", "b", "c", "d", "e")), task = task) - expect_datapreproc_pipeop_class(PipeOpTestImpute, constargs = list(param_vals = list(innum = c("a", "b", "c", "d", "e"))), task = mlr_tasks$get("iris")) + expect_datapreproc_pipeop_class(PipeOpTestImpute, constargs = list(), param_vals = list(innum = c("a", "b", "c", "d", "e")), task = mlr_tasks$get("iris")) @@ -107,79 +107,79 @@ test_that("PipeOpImpute", { task_no_lgl = TaskClassif$new("mdata", as_data_backend(mdata), target = "l") expect_datapreproc_pipeop_class(PipeOpTestImpute, task = task_no_lgl, - constargs = list(param_vals = list( + constargs = list(), param_vals = list( method_num = "median", method_fct = "oor", - add_dummy = "none"))) + add_dummy = "none")) expect_datapreproc_pipeop_class(PipeOpTestImpute, task = task, deterministic_train = FALSE, deterministic_predict = FALSE, - constargs = list(param_vals = list( + constargs = list(), param_vals = list( method_num = "median", method_fct = "oor", - add_dummy = "none"))) + add_dummy = "none")) expect_datapreproc_pipeop_class(PipeOpTestImpute, task = task_no_lgl, - constargs = list(param_vals = list( + constargs = list(), param_vals = list( method_num = "mean", method_fct = "oor", - add_dummy = "missing_train"))) + add_dummy = "missing_train")) expect_datapreproc_pipeop_class(PipeOpTestImpute, task = task, deterministic_train = FALSE, deterministic_predict = FALSE, - constargs = list(param_vals = list( + constargs = list(), param_vals = list( method_num = "mean", method_fct = "oor", - add_dummy = "missing_train"))) + add_dummy = "missing_train")) expect_datapreproc_pipeop_class(PipeOpTestImpute, task = task_no_lgl, deterministic_train = FALSE, deterministic_predict = FALSE, - constargs = list(param_vals = list( + constargs = list(), param_vals = list( method_num = "mode", method_fct = "mode", - add_dummy = "missing_train"))) + add_dummy = "missing_train")) expect_datapreproc_pipeop_class(PipeOpTestImpute, task = task, deterministic_train = FALSE, deterministic_predict = FALSE, - constargs = list(param_vals = list( + constargs = list(), param_vals = list( method_num = "mode", method_fct = "mode", - add_dummy = "missing_train"))) + add_dummy = "missing_train")) expect_datapreproc_pipeop_class(PipeOpTestImpute, task = task, deterministic_train = FALSE, deterministic_predict = FALSE, - constargs = list(param_vals = list( + constargs = list(), param_vals = list( method_num = "sample", method_fct = "sample", - add_dummy = "all"))) + add_dummy = "all")) expect_datapreproc_pipeop_class(PipeOpTestImpute, task = task, deterministic_train = FALSE, deterministic_predict = FALSE, - constargs = list(param_vals = list( + constargs = list(), param_vals = list( method_num = "hist", method_fct = "sample", - add_dummy = "all"))) + add_dummy = "all")) expect_datapreproc_pipeop_class(PipeOpTestImpute, task = task, deterministic_train = FALSE, deterministic_predict = FALSE, - constargs = list(param_vals = list( + constargs = list(), param_vals = list( method_num = "constant", method_fct = "constant", - add_dummy = "all"))) + add_dummy = "all")) expect_datapreproc_pipeop_class(PipeOpTestImpute, task = task_no_lgl, deterministic_train = FALSE, deterministic_predict = FALSE, - constargs = list(param_vals = list( + constargs = list(), param_vals = list( method_num = "oor", method_fct = "oor", - add_dummy = "missing_train"))) + add_dummy = "missing_train")) expect_datapreproc_pipeop_class(PipeOpTestImpute, task = task, deterministic_train = FALSE, deterministic_predict = FALSE, - constargs = list(param_vals = list( + constargs = list(), param_vals = list( method_num = "oor", method_fct = "oor", - add_dummy = "missing_train"))) + add_dummy = "missing_train")) po = PipeOpTestImpute$new(param_vals = list( method_num = "sample", method_fct = "sample", add_dummy = "all")) diff --git a/tests/testthat/test_pipeop_learnercv.R b/tests/testthat/test_pipeop_learnercv.R index d30fd3e53..fb742e54c 100644 --- a/tests/testthat/test_pipeop_learnercv.R +++ b/tests/testthat/test_pipeop_learnercv.R @@ -32,7 +32,7 @@ test_that("PipeOpLearnerCV - basic properties", { list(lrn), iris_with_unambiguous_mode, predict_like_train = FALSE, deterministic_train = FALSE, check_ps_default_values = FALSE) # 'insample' PipeOpLearnerCV with deterministic Learner is deterministic in every regard! expect_datapreproc_pipeop_class(PipeOpLearnerCV, - list(lrn, param_vals = list(resampling.method = "insample")), iris_with_unambiguous_mode, check_ps_default_values = FALSE) + list(lrn), iris_with_unambiguous_mode, check_ps_default_values = FALSE, param_vals = list(resampling.method = "insample")) expect_error(PipeOpLearnerCV$new()) diff --git a/tests/testthat/test_pipeop_missind.R b/tests/testthat/test_pipeop_missind.R index 31425ad55..b139ec198 100644 --- a/tests/testthat/test_pipeop_missind.R +++ b/tests/testthat/test_pipeop_missind.R @@ -28,19 +28,19 @@ test_that("PipeOpMissInd", { task_no_lgl = TaskClassif$new("mdata", as_data_backend(mdata), target = "l") expect_datapreproc_pipeop_class(PipeOpMissInd, task = task, - constargs = list(param_vals = list(which = "missing_train", type = "logical", affect_columns = NULL))) + constargs = list(), param_vals = list(which = "missing_train", type = "logical", affect_columns = NULL)) expect_datapreproc_pipeop_class(PipeOpMissInd, task = task, - constargs = list(param_vals = list(which = "all", type = "logical", affect_columns = NULL))) + constargs = list(), param_vals = list(which = "all", type = "logical", affect_columns = NULL)) expect_datapreproc_pipeop_class(PipeOpMissInd, task = task, - constargs = list(param_vals = list(which = "all", type = "factor", affect_columns = NULL))) + constargs = list(), param_vals = list(which = "all", type = "factor", affect_columns = NULL)) expect_datapreproc_pipeop_class(PipeOpMissInd, task = task, - constargs = list(param_vals = list(which = "all", type = "integer", affect_columns = NULL))) + constargs = list(), param_vals = list(which = "all", type = "integer", affect_columns = NULL)) expect_datapreproc_pipeop_class(PipeOpMissInd, task = task, - constargs = list(param_vals = list(which = "all", type = "numeric", affect_columns = NULL))) + constargs = list(), param_vals = list(which = "all", type = "numeric", affect_columns = NULL)) po = po("missind", which = "all", type = "logical", affect_columns = NULL) diff --git a/tests/testthat/test_pipeop_modelmatrix.R b/tests/testthat/test_pipeop_modelmatrix.R index 5438fce24..1ad085ada 100644 --- a/tests/testthat/test_pipeop_modelmatrix.R +++ b/tests/testthat/test_pipeop_modelmatrix.R @@ -5,7 +5,7 @@ test_that("PipeOpModelMatrix - basic properties", { task = mlr_tasks$get("iris") # General expect_datapreproc_pipeop_class(PipeOpModelMatrix, - constargs = list(param_vals = list(formula = ~ . ^ 2)), task = task) + param_vals = list(formula = ~ . ^ 2), task = task) # Intercept op = po("modelmatrix", formula = ~ . ^ 2) @@ -40,10 +40,8 @@ test_that("PipeOpModelMatrix - basic properties", { # other formula expect_datapreproc_pipeop_class(PipeOpModelMatrix, - constargs = list(param_vals = list(formula = ~ 0 + Sepal.Length + - log(Sepal.Length))), task = task) - op = po("modelmatrix", formula = ~ 0 + Sepal.Length + - log(Sepal.Length)) + param_vals = list(formula = ~ 0 + Sepal.Length + log(Sepal.Length)), task = task) + op = po("modelmatrix", formula = ~ 0 + Sepal.Length + log(Sepal.Length)) expect_pipeop(op) nt = train_pipeop(op, inputs = list(task))[[1L]] fn = nt$feature_names diff --git a/tests/testthat/test_pipeop_proxy.R b/tests/testthat/test_pipeop_proxy.R index 0e05be27a..36146d715 100644 --- a/tests/testthat/test_pipeop_proxy.R +++ b/tests/testthat/test_pipeop_proxy.R @@ -11,7 +11,7 @@ test_that("PipeOpProxy - basic properties", { test_that("PipeOpProxy - datapreproc", { pop = po("scale") - expect_datapreproc_pipeop_class(PipeOpProxy, constargs = list(param_vals = list(content = pop)), task = mlr_tasks$get("iris")) + expect_datapreproc_pipeop_class(PipeOpProxy, constargs = list(), param_vals = list(content = pop), task = mlr_tasks$get("iris")) }) test_that("PipeOpProxy - content error handling", { diff --git a/tests/testthat/test_pipeop_scale.R b/tests/testthat/test_pipeop_scale.R index 092d1d552..3f754e49c 100644 --- a/tests/testthat/test_pipeop_scale.R +++ b/tests/testthat/test_pipeop_scale.R @@ -13,7 +13,7 @@ test_that("basic properties", { expect_datapreproc_pipeop_class(PipeOpScale, task = mlr_tasks$get("pima")) - expect_datapreproc_pipeop_class(PipeOpScale, list(param_vals = list(robust = TRUE)), task = mlr_tasks$get("iris")) + expect_datapreproc_pipeop_class(PipeOpScale, task = mlr_tasks$get("iris"), param_vals = list(robust = TRUE)) data = data.table( diff --git a/tests/testthat/test_pipeop_select.R b/tests/testthat/test_pipeop_select.R index 96a769337..17b26c43f 100644 --- a/tests/testthat/test_pipeop_select.R +++ b/tests/testthat/test_pipeop_select.R @@ -9,7 +9,7 @@ test_that("select", { expect_datapreproc_pipeop_class(PipeOpSelect, task = mlr_tasks$get("iris")) expect_datapreproc_pipeop_class(PipeOpSelect, task = mlr_tasks$get("iris"), - constargs = list(param_vals = list(selector = selector_grep("^Petal")))) + constargs = list(), param_vals = list(selector = selector_grep("^Petal"))) # Selects the columns we expect it to select From 770dc893952c7fd3bceb90d5d62b62241e078999 Mon Sep 17 00:00:00 2001 From: mb706 Date: Wed, 13 Aug 2025 23:28:49 +0200 Subject: [PATCH 05/31] using po() syntax in tests IV --- tests/testthat/test_Graph.R | 4 ++-- tests/testthat/test_multichannels.R | 6 +++--- tests/testthat/test_pipeop_boxcox.R | 4 ++-- tests/testthat/test_pipeop_ensemble.R | 2 +- tests/testthat/test_pipeop_ica.R | 2 +- tests/testthat/test_pipeop_impute.R | 26 ++++++++++++++++---------- tests/testthat/test_pipeop_learnercv.R | 4 ++-- tests/testthat/test_pipeop_threshold.R | 6 +++--- 8 files changed, 30 insertions(+), 24 deletions(-) diff --git a/tests/testthat/test_Graph.R b/tests/testthat/test_Graph.R index bb1dfd609..b1885dfff 100644 --- a/tests/testthat/test_Graph.R +++ b/tests/testthat/test_Graph.R @@ -197,8 +197,8 @@ test_that("input / output lists and naming", { test_that("edges that introduce loops cannot be added", { g = Graph$new()$ - add_pipeop(PipeOpNOP$new("p1"))$ - add_pipeop(PipeOpNOP$new("p2")) + add_pipeop(po("nop", id = "p1"))$ + add_pipeop(po("nop", id = "p2")) gclone = g$clone(deep = TRUE) expect_deep_clone(g, gclone) diff --git a/tests/testthat/test_multichannels.R b/tests/testthat/test_multichannels.R index f0a1a0730..c7524b125 100644 --- a/tests/testthat/test_multichannels.R +++ b/tests/testthat/test_multichannels.R @@ -144,13 +144,13 @@ test_that("doublearrow with many output to vararg input works as expected", { test_that("vararg passes args through as it should", { - nullgraph = gunion(list(mlr_pipeops$get("nop", id = "nop1"), mlr_pipeops$get("nop", id = "nop2"))) %>>% VarargPipeop$new() + nullgraph = gunion(list(po("nop", id = "nop1"), po("nop", id = "nop2"))) %>>% VarargPipeop$new() expect_equal(nullgraph$train(1)[[1]], list(`...` = 1, `...` = 1)) graph = gunion(list( - mlr_pipeops$get("scale", id = "s1", param_vals = list(scale = TRUE, center = FALSE)), - mlr_pipeops$get("scale", id = "s2", param_vals = list(scale = FALSE, center = TRUE)))) %>>% + po("scale", id = "s1", param_vals = list(scale = TRUE, center = FALSE)), + po("scale", id = "s2", param_vals = list(scale = FALSE, center = TRUE)))) %>>% VarargPipeop$new() tsk0 = tsk1 = mlr_tasks$get("iris") diff --git a/tests/testthat/test_pipeop_boxcox.R b/tests/testthat/test_pipeop_boxcox.R index cb24cd5a3..118411db0 100644 --- a/tests/testthat/test_pipeop_boxcox.R +++ b/tests/testthat/test_pipeop_boxcox.R @@ -10,7 +10,7 @@ test_that("PipeOpBoxCox - general functionality", { test_that("PipeOpBoxCox - receive expected result", { skip_if_not_installed("bestNormalize") task = mlr_tasks$get("iris") - op = PipeOpBoxCox$new(param_vals = list(standardize = FALSE)) + op = po("boxcox", standardize = FALSE) result = train_pipeop(op, inputs = list(task)) result.pred = predict_pipeop(op, inputs = list(task)) @@ -23,7 +23,7 @@ test_that("PipeOpBoxCox - receive expected result", { expect_equal(x.trans, result.pred[[1]]$data()[[2]]) # Set lower and upper value for lambda estimation - op = PipeOpBoxCox$new(param_vals = list(upper = 0.5, lower = 0)) + op = po("boxcox", upper = 0.5, lower = 0) result = train_pipeop(op, inputs = list(task)) lambda.new = unlist(lapply(op$state$bc[1:4], function(x) x$lambda)) expect_true(all(lambda.new <= 0.5 & lambda.new >= 0)) diff --git a/tests/testthat/test_pipeop_ensemble.R b/tests/testthat/test_pipeop_ensemble.R index 45272fd08..4a514b009 100644 --- a/tests/testthat/test_pipeop_ensemble.R +++ b/tests/testthat/test_pipeop_ensemble.R @@ -1,7 +1,7 @@ context("PipeOpEnsemble") test_that("PipeOpEnsemble - basic properties", { - op = PipeOpEnsemble$new(4, id = "ensemble", param_vals = list()) + op = PipeOpEnsemble$new(4, id = "ensemble") expect_pipeop(op) expect_pipeop_class(PipeOpEnsemble, list(3, id = "ensemble"), param_vals = list()) expect_pipeop_class(PipeOpEnsemble, list(1, id = "ensemble"), param_vals = list()) diff --git a/tests/testthat/test_pipeop_ica.R b/tests/testthat/test_pipeop_ica.R index 88bf3115a..5277e5465 100644 --- a/tests/testthat/test_pipeop_ica.R +++ b/tests/testthat/test_pipeop_ica.R @@ -30,7 +30,7 @@ test_that("PipeOpICA - compare to fastICA", { expect_equal(dtres, fica$S) # Change some parameters - op2 = PipeOpICA$new(param_vals = list(method = "R", alpha = 2)) + op2 = po("ica", method = "R", alpha = 2) expect_pipeop(op2, check_ps_default_values = FALSE) set.seed(1234) result2 = op2$train(list(task)) diff --git a/tests/testthat/test_pipeop_impute.R b/tests/testthat/test_pipeop_impute.R index 5084dd47b..e380f5705 100644 --- a/tests/testthat/test_pipeop_impute.R +++ b/tests/testthat/test_pipeop_impute.R @@ -8,7 +8,7 @@ test_that("PipeOpImpute", { PipeOpTestImpute = R6Class("PipeOpTestImpute", inherit = PipeOpTaskPreprocSimple, public = list( - initialize = function(id = "impute", param_vals = list()) { + initialize = function() { ps = ps( method_num = p_fct(c("median", "mean", "mode", "sample", "hist", "oor", "constant"), tags = c("train", "predict")), method_fct = p_fct(c("oor", "sample", "mode", "constant"), tags = c("train", "predict")), @@ -16,7 +16,7 @@ test_that("PipeOpImpute", { innum = p_uty(tags = c("train", "predict")) ) ps$values = list(method_num = "median", method_fct = "oor", add_dummy = "missing_train") - super$initialize(id, ps, param_vals = param_vals) + super$initialize(id = "impute", ps) }, build_graph = function() { @@ -26,13 +26,13 @@ test_that("PipeOpImpute", { mode = po("imputemode", id = "num_mode"), sample = po("imputesample", id = "num_sample"), hist = po("imputehist"), - constant = po("imputeconstant", id = "num_constant", param_vals = list(constant = -999)), + constant = po("imputeconstant", id = "num_constant", constant = -999), oor = po("imputeoor", id = "num_oor")) fctimputer = switch(self$param_set$values$method_fct, oor = po("imputeoor", id = "fct_oor"), sample = po("imputesample", id = "fct_sample"), mode = po("imputemode", id = "fct_mode"), - constant = po("imputeconstant", id = "fct_constant", param_vals = list(constant = ".MISSING", check_levels = FALSE))) + constant = po("imputeconstant", id = "fct_constant", constant = ".MISSING", check_levels = FALSE)) if (self$param_set$values$add_dummy == "none") { dummyselector = selector_none() @@ -181,7 +181,8 @@ test_that("PipeOpImpute", { method_fct = "oor", add_dummy = "missing_train")) - po = PipeOpTestImpute$new(param_vals = list( + po = PipeOpTestImpute$new() + po$param_set$set_values(.values = list( method_num = "sample", method_fct = "sample", add_dummy = "all")) task_trained = po$train(list(task$clone(deep = TRUE)$filter(5:6)))[[1]]$data() @@ -211,7 +212,8 @@ test_that("PipeOpImpute", { expect_set_equal(colnames(task_trained), c(letters[1:13], paste0("missing_", letters[c(1:11, 13)]))) expect_set_equal(colnames(task_predicted), c(letters[1:13], paste0("missing_", letters[c(1:11, 13)]))) - po = PipeOpTestImpute$new(param_vals = list( + po = PipeOpTestImpute$new() + po$param_set$set_values(.values = list( method_num = "median", method_fct = "oor", add_dummy = "all")) task_trained = po$train(list(task$clone(deep = TRUE)$filter(5:6)))[[1]]$data() @@ -229,7 +231,8 @@ test_that("PipeOpImpute", { expect_equal(task_trained$d[2], factor(".MISSING", levels = c(letters[1:6], ".MISSING"))) expect_equal(task_trained$h[2], ".MISSING") - po = PipeOpTestImpute$new(param_vals = list( + po = PipeOpTestImpute$new() + po$param_set$set_values(.values = list( method_num = "median", method_fct = "oor", add_dummy = "missing_train")) task_trained = po$train(list(task$clone(deep = TRUE)$filter(5:6)))[[1]]$data() @@ -238,7 +241,8 @@ test_that("PipeOpImpute", { expect_set_equal(colnames(task_trained), c(letters[1:13], paste0("missing_", c("a", "c", "k", "m")))) expect_set_equal(colnames(task_predicted), c(letters[1:13], paste0("missing_", c("a", "c", "k", "m")))) - po = PipeOpTestImpute$new(param_vals = list( + po = PipeOpTestImpute$new() + po$param_set$set_values(.values = list( method_num = "median", method_fct = "oor", add_dummy = "none")) task_trained = po$train(list(task$clone(deep = TRUE)$filter(5:6)))[[1]]$data() @@ -246,7 +250,8 @@ test_that("PipeOpImpute", { expect_equal(task_predicted, task$clone(deep = TRUE)$filter(1:3)$data(), ignore.col.order = TRUE) - po = PipeOpTestImpute$new(param_vals = list( + po = PipeOpTestImpute$new() + po$param_set$set_values(.values = list( method_num = "hist", method_fct = "oor", add_dummy = "missing_train")) for (i in range(10)) { @@ -261,7 +266,8 @@ test_that("PipeOpImpute", { } # impute full na columns: - po = PipeOpTestImpute$new(param_vals = list(method_num = "median", method_fct = "oor")) + po = PipeOpTestImpute$new() + po$param_set$set_values(.values = list(method_num = "median", method_fct = "oor")) mdata = data.table( stringsAsFactors = FALSE, diff --git a/tests/testthat/test_pipeop_learnercv.R b/tests/testthat/test_pipeop_learnercv.R index fb742e54c..a734a2a69 100644 --- a/tests/testthat/test_pipeop_learnercv.R +++ b/tests/testthat/test_pipeop_learnercv.R @@ -29,10 +29,10 @@ test_that("PipeOpLearnerCV - basic properties", { lrn = mlr_learners$get("classif.featureless") iris_with_unambiguous_mode = mlr_tasks$get("iris")$filter(c(1:30, 70:150)) # want featureless learner without randomness expect_datapreproc_pipeop_class(PipeOpLearnerCV, - list(lrn), iris_with_unambiguous_mode, predict_like_train = FALSE, deterministic_train = FALSE, check_ps_default_values = FALSE) + list(lrn), task = iris_with_unambiguous_mode, predict_like_train = FALSE, deterministic_train = FALSE, check_ps_default_values = FALSE) # 'insample' PipeOpLearnerCV with deterministic Learner is deterministic in every regard! expect_datapreproc_pipeop_class(PipeOpLearnerCV, - list(lrn), iris_with_unambiguous_mode, check_ps_default_values = FALSE, param_vals = list(resampling.method = "insample")) + list(lrn), task = iris_with_unambiguous_mode, check_ps_default_values = FALSE, param_vals = list(resampling.method = "insample")) expect_error(PipeOpLearnerCV$new()) diff --git a/tests/testthat/test_pipeop_threshold.R b/tests/testthat/test_pipeop_threshold.R index d297b4a70..bd7f0d844 100644 --- a/tests/testthat/test_pipeop_threshold.R +++ b/tests/testthat/test_pipeop_threshold.R @@ -6,7 +6,7 @@ test_that("threshold general", { expect_true(po_thr$id == "threshold") expect_equal(po_thr$param_set$values$thresholds, 0.5) - po_thr = po("threshold", param_vals = list(thresholds = c(0.3, 0.5))) + po_thr = po("threshold", thresholds = c(0.3, 0.5)) expect_pipeop(po_thr) expect_true(po_thr$id == "threshold") expect_true(all(po_thr$param_set$values$thresholds == c(0.3, 0.5))) @@ -95,7 +95,7 @@ test_that("thresholding works for multiclass", { # works with named args po_thr = po("threshold", - list(thresholds = c("virginica" = 0.3, "versicolor" = 0.4, "setosa" = 0.3))) + thresholds = c("virginica" = 0.3, "versicolor" = 0.4, "setosa" = 0.3)) expect_pipeop(po_thr) gr = po_lrn %>>% po_thr gr$train(t) @@ -110,7 +110,7 @@ test_that("thresholding works for multiclass", { expect_error(gr$predict(t), "must have length one or length equal to number of outcome levels") po_thr = po("threshold", - list(thresholds = c("foo" = 0.3, "versicolor" = 0.4, "setosa" = 0.3))) + thresholds = c("foo" = 0.3, "versicolor" = 0.4, "setosa" = 0.3)) gr = po_lrn %>>% po_thr gr$train(t) expect_error(gr$predict(t)) From 6b5d90677fec7f9cb5bb96664e0396fccc3c9264 Mon Sep 17 00:00:00 2001 From: mb706 Date: Thu, 14 Aug 2025 00:40:12 +0200 Subject: [PATCH 06/31] using po() syntax in tests V --- R/PipeOp.R | 3 +- R/pipeline_bagging.R | 4 +- R/pipeline_branch.R | 4 +- tests/testthat/test_conversion.R | 11 +- tests/testthat/test_doublearrow.R | 34 +++--- tests/testthat/test_pipeop_learnerquantiles.R | 16 +-- tests/testthat/test_pipeop_missind.R | 2 +- tests/testthat/test_pipeop_updatetarget.R | 21 ++-- tests/testthat/test_po.R | 115 +++++++++++++++--- 9 files changed, 152 insertions(+), 58 deletions(-) diff --git a/R/PipeOp.R b/R/PipeOp.R index b086260ad..6995df6de 100644 --- a/R/PipeOp.R +++ b/R/PipeOp.R @@ -263,7 +263,8 @@ PipeOp = R6Class("PipeOp", ## ------ deprecating id and param_vals sc = sys.calls() found = 0 - for (i in rev(seq_along(sc))) { + # exclude the last (i.e., current) and second-tolast frame, these are PipeOp$new() directly. + for (i in rev(seq_along(sc))[-c(1, 2)]) { if (identical(sc[[i]], quote(initialize(...)))) { found = i break diff --git a/R/pipeline_bagging.R b/R/pipeline_bagging.R index 5ff6bde34..94433e14d 100644 --- a/R/pipeline_bagging.R +++ b/R/pipeline_bagging.R @@ -57,8 +57,8 @@ pipeline_bagging = function(graph, iterations = 10, frac = 0.7, averager = NULL, averager = as_graph(averager, clone = TRUE) } - po("replicate", param_vals = list(reps = iterations)) %>>!% - po("subsample", param_vals = list(frac = frac, replace = replace)) %>>!% + po("replicate", reps = iterations) %>>!% + po("subsample", frac = frac, replace = replace) %>>!% g %>>!% averager } diff --git a/R/pipeline_branch.R b/R/pipeline_branch.R index 7637e1529..33f5ecd0a 100644 --- a/R/pipeline_branch.R +++ b/R/pipeline_branch.R @@ -78,10 +78,10 @@ pipeline_branch = function(graphs, prefix_branchops = "", prefix_paths = FALSE) poname_prefix = "" } - graph = gunion(graphs) %>>!% PipeOpUnbranch$new(branches, id = paste0(prefix_branchops, "unbranch")) + graph = gunion(graphs) %>>!% po("unbranch", branches, id = paste0(prefix_branchops, "unbranch")) branch_id = paste0(prefix_branchops, "branch") - po_branch = PipeOpBranch$new(branches, id = branch_id) + po_branch = po("branch", branches, id = branch_id) graph$add_pipeop(po_branch) pmap(list(graphs, poname_prefix, po_branch$output$name), function(gr, pnp, branch_chan) { diff --git a/tests/testthat/test_conversion.R b/tests/testthat/test_conversion.R index ad77300e4..1b2330759 100644 --- a/tests/testthat/test_conversion.R +++ b/tests/testthat/test_conversion.R @@ -97,7 +97,8 @@ test_that("po for Filter", { flt = mlr3filters::FilterVariance$new() flt$param_set$values$na.rm = TRUE - fpo1 = PipeOpFilter$new(flt, param_vals = list(na.rm = FALSE)) + fpo1 = PipeOpFilter$new(flt) + fpo1$param_set$set_values(.values = list(na.rm = FALSE)) fpo2 = po("filter", flt, na.rm = FALSE) @@ -113,7 +114,8 @@ test_that("po for Learner", { lrn = LearnerClassifRpart$new() lrn$param_set$values$xval = 9 - lpo1 = touch(PipeOpLearner$new(lrn, param_vals = list(xval = 1))) + lpo1 = touch(PipeOpLearner$new(lrn)) + lpo1$param_set$set_values(.values = list(xval = 1)) lpo2 = po("learner", lrn, xval = 1) @@ -150,7 +152,7 @@ test_that("Graph to GraphLearner", { test_that("PipeOp to GraphLearner", { skip_if_not_installed("rpart") - po = po("proxy", param_vals = list(content = lrn("classif.rpart"))) + po = po("proxy", content = lrn("classif.rpart")) glrn1 = GraphLearner$new(po) @@ -167,7 +169,8 @@ test_that("PipeOp to GraphLearner", { expect_equal(r1, r3) - po_cv = po("learner_cv", learner = po, param_vals = list(resampling.method = "insample")) + po_cv = po("learner_cv", learner = po) + po_cv$param_set$set_values(.values = list(resampling.method = "insample")) expect_true("GraphLearner" %in% class(po_cv$learner)) train_out = po_cv$train(list(task)) diff --git a/tests/testthat/test_doublearrow.R b/tests/testthat/test_doublearrow.R index 2e142d84c..339703125 100644 --- a/tests/testthat/test_doublearrow.R +++ b/tests/testthat/test_doublearrow.R @@ -1,13 +1,13 @@ context("double-arrow") test_that("Simple ops do what we expect", { - p1 = PipeOpNOP$new("p1") - p2 = PipeOpNOP$new("p2") - p3 = PipeOpNOP$new("p3") - p4 = PipeOpNOP$new("p4") - p5 = PipeOpNOP$new("p5") - p6 = PipeOpNOP$new("p6") - p7 = PipeOpNOP$new("p7") + p1 = po("nop", id = "p1") + p2 = po("nop", id = "p2") + p3 = po("nop", id = "p3") + p4 = po("nop", id = "p4") + p5 = po("nop", id = "p5") + p6 = po("nop", id = "p6") + p7 = po("nop", id = "p7") g = p1 %>>% p2 %>>% p3 expect_class(g, "Graph") @@ -51,11 +51,11 @@ test_that("Simple ops do what we expect", { }) test_that("operations make deep copies", { - p1 = PipeOpNOP$new("p1") - p2 = PipeOpNOP$new("p2") + p1 = po("nop", id = "p1") + p2 = po("nop", id = "p2") - g3 = Graph$new()$add_pipeop(PipeOpNOP$new("p3")) - g4 = Graph$new()$add_pipeop(PipeOpNOP$new("p4")) + g3 = Graph$new()$add_pipeop(po("nop", id = "p3")) + g4 = Graph$new()$add_pipeop(po("nop", id = "p4")) g = p1 %>>% p2 expect_deep_clone(g$pipeops$p1, p1) @@ -67,7 +67,7 @@ test_that("operations make deep copies", { }) test_that("neutral elements", { - p = PipeOpNOP$new("p1") + p = po("nop", id = "p1") g1 = p %>>% NULL expect_graph(g1) expect_true((length(g1$pipeops) == 1L) && (names(g1$pipeops) == "p1")) @@ -77,9 +77,9 @@ test_that("neutral elements", { test_that("triple-arrow", { - p1 = PipeOpNOP$new("p1") - p2 = PipeOpNOP$new("p2") - p3 = PipeOpNOP$new("p3") + p1 = po("nop", id = "p1") + p2 = po("nop", id = "p2") + p3 = po("nop", id = "p3") gr = as_graph(p1) @@ -145,14 +145,14 @@ test_that("triple-arrow", { gr = p1 %>>!% p2graph1 - expect_deep_clone(p1, PipeOpNOP$new("p1")) + expect_deep_clone(p1, po("nop", id = "p1")) expect_deep_clone(p2graph1, as_graph(p2)) expect_deep_clone(gr, p1 %>>% p2) gr = chain_graphs(list(p1, p2graph1), in_place = TRUE) - expect_deep_clone(p1, PipeOpNOP$new("p1")) + expect_deep_clone(p1, po("nop", id = "p1")) expect_deep_clone(p2graph1, as_graph(p2)) expect_deep_clone(gr, p1 %>>% p2) diff --git a/tests/testthat/test_pipeop_learnerquantiles.R b/tests/testthat/test_pipeop_learnerquantiles.R index f6d43a3d9..eae4e0790 100644 --- a/tests/testthat/test_pipeop_learnerquantiles.R +++ b/tests/testthat/test_pipeop_learnerquantiles.R @@ -63,20 +63,20 @@ test_that("PipeOpLearnerQuantiles - param set and values", { po$param_set$values$quantiles.q_response = 0.05 expect_equal(po$param_set$values, list(quantiles.q_vals = c(0.05, 0.5, 0.95), quantiles.q_response = 0.05, robust = TRUE)) - # Anfang der Error messages - expect_error(PipeOpLearnerQuantiles$new(lrn, param_vals = list(quantiles.q_vals = c(0.75, 0.25, 0.5))), "sorted") - expect_error(PipeOpLearnerQuantiles$new(lrn, param_vals = list(quantiles.q_vals = c(0.75, 0.25, NA))), "missing values") - expect_error(PipeOpLearnerQuantiles$new(lrn, param_vals = list(quantiles.q_vals = -0.1)), ">= 0") - expect_error(PipeOpLearnerQuantiles$new(lrn, param_vals = list(quantiles.q_vals = 1.1)), "<= 1") - expect_error(PipeOpLearnerQuantiles$new(lrn, param_vals = list(quantiles.q_response = -1))) + # Beginning of error messages + expect_error(po("learner_quantiles", lrn, quantiles.q_vals = c(0.75, 0.25, 0.5)), "sorted") + expect_error(po("learner_quantiles", lrn, quantiles.q_vals = c(0.75, 0.25, NA)), "missing values") + expect_error(po("learner_quantiles", lrn, quantiles.q_vals = -0.1), ">= 0") + expect_error(po("learner_quantiles", lrn, quantiles.q_vals = 1.1), "<= 1") + expect_error(po("learner_quantiles", lrn, quantiles.q_response = -1)) # q_response %in% q_vals task = mlr_tasks$get("mtcars") - po_response = PipeOpLearnerQuantiles$new(lrn, param_vals = list(quantiles.q_vals = c(0.25, 0.75), quantiles.q_response = 0.5)) + po_response = po("learner_quantiles", lrn, quantiles.q_vals = c(0.25, 0.75), quantiles.q_response = 0.5) expect_error(train_pipeop(po_response, list(task)), "additional elements") lrn_classif = mlr_learners$get("classif.featureless") - expect_error(PipeOpLearnerQuantiles$new(lrn_classif), "only supports regression") + expect_error(po("learner_quantiles", lrn_classif), "only supports regression") }) test_that("PipeOpLearnerQuantiles - graph but no id", { diff --git a/tests/testthat/test_pipeop_missind.R b/tests/testthat/test_pipeop_missind.R index b139ec198..360218bf2 100644 --- a/tests/testthat/test_pipeop_missind.R +++ b/tests/testthat/test_pipeop_missind.R @@ -109,7 +109,7 @@ test_that("union with missing rows", { data2[1:1, cyl:=NA] imp_missind = po("missind") - imp_num = po("imputehist", param_vals = list(affect_columns = selector_type("numeric"))) + imp_num = po("imputehist", affect_columns = selector_type("numeric")) learner = lrn("regr.rpart") g1 = gunion(list(imp_num, imp_missind)) %>>% po("featureunion") diff --git a/tests/testthat/test_pipeop_updatetarget.R b/tests/testthat/test_pipeop_updatetarget.R index 67f1425e4..a91d27085 100644 --- a/tests/testthat/test_pipeop_updatetarget.R +++ b/tests/testthat/test_pipeop_updatetarget.R @@ -2,7 +2,8 @@ context("PipeOpUpdateTarget") test_that("update target multi to binary", { trafo_fun = function(x) {factor(ifelse(x == "setosa", "setosa", "other"))} - pom = PipeOpUpdateTarget$new(param_vals = list(trafo = trafo_fun, new_target_name = "setosa")) + pom = PipeOpUpdateTarget$new() + pom$param_set$set_values(.values = list(trafo = trafo_fun, new_target_name = "setosa")) expect_pipeop(pom) newtsk = pom$train(list(tsk("iris")))[[1]] expect_task(newtsk) @@ -18,7 +19,8 @@ test_that("update target multi to binary", { test_that("update target regr to classif", { trafo_fun = function(x) {factor(ifelse(x < 25, "<25", ">=25"))} - pom = PipeOpUpdateTarget$new(param_vals = list(trafo = trafo_fun, new_target_name = "threshold_25", new_task_type = "classif")) + pom = PipeOpUpdateTarget$new() + pom$param_set$set_values(.values = list(trafo = trafo_fun, new_target_name = "threshold_25", new_task_type = "classif")) expect_pipeop(pom) newtsk = pom$train(list(tsk("boston_housing_classic")))[[1]] expect_task(newtsk) @@ -36,7 +38,8 @@ test_that("update target classif to regr", { # this is e.g. used in mlr3ordinal for casting # orginal to regr trafo_fun = function(x) {map_dtc(x, as.numeric)} - pom = PipeOpUpdateTarget$new(param_vals = list(trafo = trafo_fun, new_target_name = "quality", new_task_type = "regr")) + pom = PipeOpUpdateTarget$new() + pom$param_set$set_values(.values = list(trafo = trafo_fun, new_target_name = "quality", new_task_type = "regr")) expect_pipeop(pom) newtsk = pom$train(list(tsk("wine")))[[1]] expect_true(inherits(newtsk, "TaskRegr")) @@ -54,7 +57,8 @@ test_that("update target classif to regr", { test_that("update target same target", { # this is e.g. used in mlr3ordinal for casting # orginal to classif - pom = PipeOpUpdateTarget$new(param_vals = list(new_target_name = "type", new_task_type = "classif")) + pom = PipeOpUpdateTarget$new() + pom$param_set$set_values(.values = list(new_target_name = "type", new_task_type = "classif")) expect_pipeop(pom) newtsk = pom$train(list(tsk("wine")))[[1]] expect_task(newtsk) @@ -69,7 +73,8 @@ test_that("update target same target", { }) test_that("rename target", { - pom = PipeOpUpdateTarget$new(param_vals = list(new_target_name = "new_type")) + pom = PipeOpUpdateTarget$new() + pom$param_set$set_values(.values = list(new_target_name = "new_type")) expect_pipeop(pom) newtsk = pom$train(list(tsk("wine")))[[1]] expect_task(newtsk) @@ -88,7 +93,8 @@ test_that("update resample and predict_newdata", { skip_if_not_installed("rpart") skip_on_cran() t = tsk("wine") - pom = PipeOpUpdateTarget$new(param_vals = list(new_target_name = "type", new_task_type = "classif")) + pom = PipeOpUpdateTarget$new() + pom$param_set$set_values(.values = list(new_target_name = "type", new_task_type = "classif")) g = GraphLearner$new(pom %>>% lrn("classif.rpart")) r = resample(t, g, rsmp("holdout")) expect_numeric(r$score()$classif.ce) @@ -97,7 +103,8 @@ test_that("update resample and predict_newdata", { }) test_that("make an existing feature a target", { - pom = PipeOpUpdateTarget$new(param_vals = list(new_target_name = "ash", new_task_type = "regr", drop_original_target = FALSE)) + pom = PipeOpUpdateTarget$new() + pom$param_set$set_values(.values = list(new_target_name = "ash", new_task_type = "regr", drop_original_target = FALSE)) expect_pipeop(pom) newtsk = pom$train(list(tsk("wine")))[[1]] expect_task(newtsk) diff --git a/tests/testthat/test_po.R b/tests/testthat/test_po.R index eaff5c07f..3eada9669 100644 --- a/tests/testthat/test_po.R +++ b/tests/testthat/test_po.R @@ -12,12 +12,21 @@ test_that("mlr_pipeops access works", { expect_equal( po("scale", center = FALSE), - mlr_pipeops$get("scale", param_vals = list(center = FALSE)) + { + x = mlr_pipeops$get("scale") + x$param_set$set_values(.values = list(center = FALSE)) + x + } ) expect_equal( po("scale", id = "sx", center = FALSE), - PipeOpScale$new(id = "sx", param_vals = list(center = FALSE)) + { + x = PipeOpScale$new() + x$id = "sx" + x$param_set$set_values(.values = list(center = FALSE)) + x + } ) expect_equal( @@ -37,17 +46,38 @@ test_that("mlr_pipeops access works", { expect_equal( po("learner", mlr_learners$get("classif.rpart"), xval = 1), - mlr_pipeops$get("learner", mlr_learners$get("classif.rpart"), param_vals = list(xval = 1)) + { + x = mlr_pipeops$get("learner", mlr_learners$get("classif.rpart")) + x$param_set$set_values(.values = list(xval = 1)) + x + } ) expect_equal( - po("learner", mlr_learners$get("classif.rpart"), xval = 1, param_vals = list(cp = 0.5)), - mlr_pipeops$get("learner", mlr_learners$get("classif.rpart"), param_vals = list(xval = 1, cp = 0.5)) + { + x = po("learner", mlr_learners$get("classif.rpart"), xval = 1) + x$param_set$set_values(.values = list(cp = 0.5)) + x + }, + { + x = mlr_pipeops$get("learner", mlr_learners$get("classif.rpart")) + x$param_set$set_values(.values = list(xval = 1, cp = 0.5)) + x + } ) expect_equal( - po("learner", mlr_learners$get("classif.rpart"), xval = 1, param_vals = list(cp = 0.5), id = "blabla"), - mlr_pipeops$get("learner", mlr_learners$get("classif.rpart"), param_vals = list(xval = 1, cp = 0.5), id = "blabla") + { + x = po("learner", mlr_learners$get("classif.rpart"), xval = 1, id = "blabla") + x$param_set$set_values(.values = list(cp = 0.5)) + x + }, + { + x = mlr_pipeops$get("learner", mlr_learners$get("classif.rpart")) + x$param_set$set_values(.values = list(xval = 1, cp = 0.5)) + x$id = "blabla" + x + } ) expect_error(po("learnerx"), "'learner'") @@ -63,12 +93,16 @@ test_that("mlr_pipeops access works", { expect_equal( po("learner", dblrn$new(), key = 99), - mlr_pipeops$get("learner", dblrn$new(), param_vals = list(key = 99)) + { + x = mlr_pipeops$get("learner", dblrn$new()) + x$param_set$set_values(.values = list(key = 99)) + x + } ) expect_equal( - po("select", param_vals = list(selector = selector_all())), + po("select", selector = selector_all()), po(selector_all()) ) @@ -79,7 +113,11 @@ test_that("mlr_pipeops access works", { expect_equal( po(dblrn$new(), key = 99), - mlr_pipeops$get("learner", dblrn$new(), param_vals = list(key = 99)) + { + x = mlr_pipeops$get("learner", dblrn$new()) + x$param_set$set_values(.values = list(key = 99)) + x + } ) polrn = po(dblrn$new(), key = 99) @@ -119,7 +157,13 @@ test_that("mlr_pipeops multi-access works", { expect_equal( unname(pos("scale", center = FALSE)), - list(mlr_pipeops$get("scale", param_vals = list(center = FALSE))) + list( + { + x = mlr_pipeops$get("scale") + x$param_set$set_values(.values = list(center = FALSE)) + x + } + ) ) expect_error( @@ -129,13 +173,31 @@ test_that("mlr_pipeops multi-access works", { expect_equal( unname(pos(c("scale", "pca"), center = FALSE)), - list(mlr_pipeops$get("scale", param_vals = list(center = FALSE)), mlr_pipeops$get("pca", param_vals = list(center = FALSE))) + list( + { + x = mlr_pipeops$get("scale") + x$param_set$set_values(.values = list(center = FALSE)) + x + }, + { + x = mlr_pipeops$get("pca") + x$param_set$set_values(.values = list(center = FALSE)) + x + } + ) ) expect_equal( unname(pos("scale", id = "sx", center = FALSE)), - list(PipeOpScale$new(id = "sx", param_vals = list(center = FALSE))) + list( + { + x = PipeOpScale$new() + x$id = "sx" + x$param_set$set_values(.values = list(center = FALSE)) + x + } + ) ) expect_equal( @@ -167,12 +229,22 @@ test_that("mlr_pipeops multi-access works", { expect_equal( unname(pos("learner", dblrn$new(), key = 99)), - list(mlr_pipeops$get("learner", dblrn$new(), param_vals = list(key = 99))) + list( + { + x = mlr_pipeops$get("learner", dblrn$new()) + x$param_set$set_values(.values = list(key = 99)) + x + } + ) ) expect_equal( - po("select", param_vals = list(selector = selector_all())), + { + x = po("select") + x$param_set$set_values(.values = list(selector = selector_all())) + x + }, po(selector_all()) ) @@ -183,7 +255,18 @@ test_that("mlr_pipeops multi-access works", { expect_equal( unname(pos(list(dblrn$new(), dblrn$new()), key = 99)), - list(mlr_pipeops$get("learner", dblrn$new(), param_vals = list(key = 99)), mlr_pipeops$get("learner", dblrn$new(), param_vals = list(key = 99))) + list( + { + x = mlr_pipeops$get("learner", dblrn$new()) + x$param_set$set_values(.values = list(key = 99)) + x + }, + { + x = mlr_pipeops$get("learner", dblrn$new()) + x$param_set$set_values(.values = list(key = 99)) + x + } + ) ) expect_equal(unname(pos(character(0))), list()) From a5c72fa794fba2d90983a70347b3007718a43428 Mon Sep 17 00:00:00 2001 From: mb706 Date: Thu, 14 Aug 2025 01:07:10 +0200 Subject: [PATCH 07/31] using po() syntax in tests VI --- tests/testthat/test_gunion.R | 24 +++++------ tests/testthat/test_mlr_graphs_branching.R | 50 +++++++++++----------- tests/testthat/test_multichannels.R | 11 ++--- tests/testthat/test_pipeop_targettrafo.R | 2 +- tests/testthat/test_pipeop_task_preproc.R | 9 ++-- tests/testthat/test_typecheck.R | 14 +++--- 6 files changed, 57 insertions(+), 53 deletions(-) diff --git a/tests/testthat/test_gunion.R b/tests/testthat/test_gunion.R index f80b3a104..7ae2086e7 100644 --- a/tests/testthat/test_gunion.R +++ b/tests/testthat/test_gunion.R @@ -1,14 +1,14 @@ context("gunion") test_that("gunion", { - g1 = PipeOpPCA$new() %>>% PipeOpScale$new(param_vals = list(scale = FALSE)) - g2 = PipeOpPCA$new(id = "pca2") %>>% PipeOpPCA$new(id = "xx") - g3 = PipeOpScale$new(id = "blub") %>>% PipeOpScale$new(id = "foo") + g1 = po("pca") %>>% po("scale", scale = FALSE) + g2 = po("pca", id = "pca2") %>>% po("pca", id = "xx") + g3 = po("scale", id = "blub") %>>% po("scale", id = "foo") g4 = gunion(list(g1, g2, g3)) expect_graph(g4) expect_set_equal(g4$ids(), c("pca", "pca2", "scale", "xx", "blub", "foo")) - expect_deep_clone(g1, PipeOpPCA$new() %>>% PipeOpScale$new(param_vals = list(scale = FALSE))) + expect_deep_clone(g1, po("pca") %>>% po("scale", scale = FALSE)) params = g4$param_set$params @@ -21,16 +21,16 @@ test_that("gunion", { expect_deep_clone(params, g4_2$param_set$params) - g0 = PipeOpNOP$new() + g0 = po("nop") g4 = gunion(list(g0, g2, g3)) expect_set_equal(g4$ids(), c("nop", "pca2", "xx", "blub", "foo")) - expect_deep_clone(g0, PipeOpNOP$new()) + expect_deep_clone(g0, po("nop")) g4_2 = gunion(list(g0, g2, g3), in_place = TRUE) - expect_deep_clone(g0, PipeOpNOP$new()) + expect_deep_clone(g0, po("nop")) expect_deep_clone(touch(g4_2), touch(g4)) @@ -65,9 +65,9 @@ test_that("named gunion", { expect_equal( touch(gunion(list(a = po("scale"), b = po("pca"), po("subsample")))), touch(Graph$new()$ - add_pipeop(PipeOpScale$new(id = "a.scale"))$ - add_pipeop(PipeOpPCA$new(id = "b.pca"))$ - add_pipeop(PipeOpSubsample$new())) + add_pipeop(po("scale", id = "a.scale"))$ + add_pipeop(po("pca", id = "b.pca"))$ + add_pipeop(po("subsample"))) ) expect_equal( @@ -103,8 +103,8 @@ test_that("named gunion", { expect_equal(gg, Graph$new()$ - add_pipeop(po("nop", id = "op1"))$ - add_pipeop(po("scale", id = "op2")) + add_pipeop(po("nop", id = "op1"))$ + add_pipeop(po("scale", id = "op2")) ) diff --git a/tests/testthat/test_mlr_graphs_branching.R b/tests/testthat/test_mlr_graphs_branching.R index e76a55473..9700aa51e 100644 --- a/tests/testthat/test_mlr_graphs_branching.R +++ b/tests/testthat/test_mlr_graphs_branching.R @@ -24,15 +24,15 @@ test_that("Branching Pipeline", { test_that("Branching Pipeline extended tests", { skip_on_cran() # takes too long - po1 = PipeOpScale$new() - po2 = PipeOpScale$new("scale2") - po3 = PipeOpPCA$new() - po4 = PipeOpSubsample$new() + po1 = po("scale") + po2 = po("scale", id = "scale2") + po3 = po("pca") + po4 = po("subsample") - pofu = PipeOpFeatureUnion$new(2) - pofu2 = PipeOpFeatureUnion$new(3) + pofu = po("featureunion", 2) + pofu2 = po("featureunion", 3) - poco = PipeOpCopy$new(2) + poco = po("copy", 2) # bring graphs into comparable form: sort $pipeops canonical = function(graph) { @@ -47,31 +47,31 @@ test_that("Branching Pipeline extended tests", { # single input/output expect_graph_equal( pipeline_branch(list(po1, po2)), - PipeOpBranch$new(2) %>>% gunion(list(po1, po2)) %>>% PipeOpUnbranch$new(2) + po("branch", 2) %>>% gunion(list(po1, po2)) %>>% po("unbranch", 2) ) # single input/output, named expect_graph_equal( pipeline_branch(list(a = po1, b = po2)), - PipeOpBranch$new(c("a", "b")) %>>% gunion(list(po1, po2)) %>>% PipeOpUnbranch$new(c("a", "b")) + po("branch", c("a", "b")) %>>% gunion(list(po1, po2)) %>>% po("unbranch", c("a", "b")) ) # single input/output, using .graph expect_graph_equal( pipeline_branch(graphs = list(po1, po2)), - PipeOpBranch$new(2) %>>% gunion(list(po1, po2)) %>>% PipeOpUnbranch$new(2) + po("branch", 2) %>>% gunion(list(po1, po2)) %>>% po("unbranch", 2) ) ## # single input/output, using both .graph and argument ## expect_graph_equal( ## pipeline_branch(po1, .graphs = list(po2)), - ## PipeOpBranch$new(2) %>>% gunion(list(po1, po2)) %>>% PipeOpUnbranch$new(2) + ## po("branch", 2) %>>% gunion(list(po1, po2)) %>>% po("unbranch", 2) ## ) ## # single input/output, using both .graph and argument, named ## expect_graph_equal( ## pipeline_branch(a = po1, .graphs = list(b = po2)), - ## PipeOpBranch$new(c("a", "b")) %>>% gunion(list(po1, po2)) %>>% PipeOpUnbranch$new(c("a", "b")) + ## po("branch", c("a", "b")) %>>% gunion(list(po1, po2)) %>>% po("unbranch", c("a", "b")) ## ) ## # error if some args named, some not named @@ -80,39 +80,39 @@ test_that("Branching Pipeline extended tests", { # prefix branch operations expect_graph_equal( pipeline_branch(list(po1, po2), prefix_branchops = "xy_"), - PipeOpBranch$new(2, id = "xy_branch") %>>% gunion(list(po1, po2)) %>>% PipeOpUnbranch$new(2, id = "xy_unbranch") + po("branch", 2, id = "xy_branch") %>>% gunion(list(po1, po2)) %>>% po("unbranch", 2, id = "xy_unbranch") ) # prefix branch operations, named expect_graph_equal( pipeline_branch(list(a = po1, b = po2), prefix_branchops = "xy_"), - PipeOpBranch$new(c("a", "b"), id = "xy_branch") %>>% - gunion(list(po1, po2)) %>>% PipeOpUnbranch$new(c("a", "b"), id = "xy_unbranch") + po("branch", c("a", "b"), id = "xy_branch") %>>% + gunion(list(po1, po2)) %>>% po("unbranch", c("a", "b"), id = "xy_unbranch") ) # prefix branch operations and paths expect_graph_equal( pipeline_branch(list(po1, po2), prefix_branchops = "xy_", prefix_paths = TRUE), - PipeOpBranch$new(2, id = "xy_branch") %>>% - gunion(list(po1 = po1, po2 = po2)) %>>% PipeOpUnbranch$new(2, id = "xy_unbranch") + po("branch", 2, id = "xy_branch") %>>% + gunion(list(po1 = po1, po2 = po2)) %>>% po("unbranch", 2, id = "xy_unbranch") ) # prefix branch operations and paths, named expect_graph_equal( pipeline_branch(list(a = po1, b = po2), prefix_branchops = "xy_", prefix_paths = TRUE), - PipeOpBranch$new(c("a", "b"), id = "xy_branch") %>>% - gunion(list(a = po1, b = po2)) %>>% PipeOpUnbranch$new(c("a", "b"), id = "xy_unbranch") + po("branch", c("a", "b"), id = "xy_branch") %>>% + gunion(list(a = po1, b = po2)) %>>% po("unbranch", c("a", "b"), id = "xy_unbranch") ) # more than one input expect_graph_equal( pipeline_branch(list(gunion(list(po1, po3)) %>>% pofu, po2)), gunion(list( - PipeOpBranch$new(2), + po("branch", 2), gunion(list( gunion(list(po1, po3)) %>>% pofu, po2)) %>>% - PipeOpUnbranch$new(2)))$ + po("unbranch", 2)))$ add_edge("branch", "scale", src_channel = "output1")$ add_edge("branch", "pca", src_channel = "output1")$ add_edge("branch", "scale2", src_channel = "output2") @@ -122,12 +122,12 @@ test_that("Branching Pipeline extended tests", { expect_graph_equal( pipeline_branch(list(b = po2, a = gunion(list(po1, po3)) %>>% pofu)), gunion(list( - PipeOpBranch$new(c("b", "a")), + po("branch", c("b", "a")), gunion(list( po2, gunion(list(po1, po3)) %>>% pofu )) %>>% - PipeOpUnbranch$new(c("b", "a"))))$ + po("unbranch", c("b", "a"))))$ add_edge("branch", "scale", src_channel = "a")$ add_edge("branch", "pca", src_channel = "a")$ add_edge("branch", "scale2", src_channel = "b") @@ -141,12 +141,12 @@ test_that("Branching Pipeline extended tests", { expect_graph_equal( pipeline_branch(list(a = gunion(list(po1, po3)) %>>% pofu, b = pofu2), prefix_branchops = "xy_", prefix_paths = TRUE), gunion(list( - PipeOpBranch$new(c("a", "b"), id = "xy_branch"), + po("branch", c("a", "b"), id = "xy_branch"), gunion(list( a = gunion(list(po1, po3)) %>>% pofu, b = pofu2 )) %>>% - PipeOpUnbranch$new(c("a", "b"), id = "xy_unbranch")))$ + po("unbranch", c("a", "b"), id = "xy_unbranch")))$ add_edge("xy_branch", "a.scale", src_channel = "a")$ add_edge("xy_branch", "a.pca", src_channel = "a")$ add_edge("xy_branch", "b.featureunion", src_channel = "b", dst_channel = "input1")$ diff --git a/tests/testthat/test_multichannels.R b/tests/testthat/test_multichannels.R index c7524b125..9420870c9 100644 --- a/tests/testthat/test_multichannels.R +++ b/tests/testthat/test_multichannels.R @@ -58,8 +58,9 @@ test_that("multiple edges on output channel copies, as expected", { expect_identical(tsk0, tsk2) graph = po("nop") %>>% gunion(list( - mlr_pipeops$get("scale", id = "s1", param_vals = list(scale = TRUE, center = FALSE)), - mlr_pipeops$get("scale", id = "s2", param_vals = list(scale = FALSE, center = TRUE)))) + po("scale", id = "s1", scale = TRUE, center = FALSE), + po("scale", id = "s2", scale = FALSE, center = TRUE) + )) tmp = graph$train(tsk0) @@ -149,9 +150,9 @@ test_that("vararg passes args through as it should", { expect_equal(nullgraph$train(1)[[1]], list(`...` = 1, `...` = 1)) graph = gunion(list( - po("scale", id = "s1", param_vals = list(scale = TRUE, center = FALSE)), - po("scale", id = "s2", param_vals = list(scale = FALSE, center = TRUE)))) %>>% - VarargPipeop$new() + po("scale", id = "s1", scale = TRUE, center = FALSE), + po("scale", id = "s2", scale = FALSE, center = TRUE) + )) %>>% VarargPipeop$new() tsk0 = tsk1 = mlr_tasks$get("iris") tsk_clone = tsk0$clone(deep = TRUE) diff --git a/tests/testthat/test_pipeop_targettrafo.R b/tests/testthat/test_pipeop_targettrafo.R index a2719b6d5..133554a48 100644 --- a/tests/testthat/test_pipeop_targettrafo.R +++ b/tests/testthat/test_pipeop_targettrafo.R @@ -3,7 +3,7 @@ context("PipeOpTargetTrafo") test_that("PipeOpTargetTrafo - basic properties", { expect_pipeop_class(PipeOpTargetTrafo, list(id = "po")) - po = PipeOpTargetTrafo$new("po") + po = PipeOpTargetTrafo$new(id = "po") expect_pipeop(po) expect_data_table(po$input, nrows = 1L) diff --git a/tests/testthat/test_pipeop_task_preproc.R b/tests/testthat/test_pipeop_task_preproc.R index 84fed91a0..dc2cf1df6 100644 --- a/tests/testthat/test_pipeop_task_preproc.R +++ b/tests/testthat/test_pipeop_task_preproc.R @@ -28,11 +28,13 @@ test_that("Wrong affect_columns errors", { ) ) tsk = tsk("boston_housing_classic") - po = POPP$new("foo", param_vals = list(affect_columns = is.factor)) + po = POPP$new(id = "foo") + po$param_set$set_values(.values = list(affect_columns = is.factor)) expect_pipeop(po) expect_error(po$train(list(tsk)), "affected_cols") - po = POPP$new("foo", param_vals = list(affect_columns = function(x) x$target_names)) + po = POPP$new(id = "foo") + po$param_set$set_values(.values = list(affect_columns = function(x) x$target_names)) expect_error(po$train(list(tsk)), "affected_cols") }) @@ -45,7 +47,8 @@ test_that("PipeOpTaskPreproc - fix for #864 works", { .predict_dt = function(dt, levels) dt ) ) - po = POPP$new("test", param_vals = list(affect_columns = selector_name("Petal.Length"))) + po = POPP$new(id = "test") + po$param_set$set_values(.values = list(affect_columns = selector_name("Petal.Length"))) expect_pipeop(po) task = mlr_tasks$get("iris") task$col_roles$order = "Petal.Width" diff --git a/tests/testthat/test_typecheck.R b/tests/testthat/test_typecheck.R index 11a214498..b7d761dc7 100644 --- a/tests/testthat/test_typecheck.R +++ b/tests/testthat/test_typecheck.R @@ -5,11 +5,11 @@ test_that("utility function works", { skip_if_not_installed("rpart") expect_null(get_r6_inheritance("data.table")) - expect_equal(get_r6_inheritance("PipeOp"), "PipeOp") + expect_equal(get_r6_inheritance("PipeOp"), c("PipeOp", "Mlr3Component")) - expect_equal(get_r6_inheritance("PipeOpEncode"), c("PipeOpEncode", "PipeOpTaskPreprocSimple", "PipeOpTaskPreproc", "PipeOp")) + expect_equal(get_r6_inheritance("PipeOpEncode"), c("PipeOpEncode", "PipeOpTaskPreprocSimple", "PipeOpTaskPreproc", "PipeOp", "Mlr3Component")) - expect_equal(get_r6_inheritance("LearnerClassifDebug"), c("LearnerClassifDebug", "LearnerClassif", "Learner")) + expect_equal(get_r6_inheritance("LearnerClassifDebug"), c("LearnerClassifDebug", "LearnerClassif", "Learner", "Mlr3Component")) expect_equal(get_class_hierarchy("data.table"), c("data.table", "data.frame")) @@ -19,11 +19,11 @@ test_that("utility function works", { expect_equal(oldcache, class_hierarchy_cache) - expect_equal(get_class_hierarchy("LearnerClassifDebug"), c("LearnerClassifDebug", "LearnerClassif", "Learner")) + expect_equal(get_class_hierarchy("LearnerClassifDebug"), c("LearnerClassifDebug", "LearnerClassif", "Learner", "Mlr3Component")) - expect_equal(class_hierarchy_cache[["LearnerClassifDebug"]], c("LearnerClassifDebug", "LearnerClassif", "Learner")) - expect_equal(class_hierarchy_cache[["LearnerClassif"]], c("LearnerClassif", "Learner")) - expect_equal(class_hierarchy_cache[["Learner"]], "Learner") + expect_equal(class_hierarchy_cache[["LearnerClassifDebug"]], c("LearnerClassifDebug", "LearnerClassif", "Learner", "Mlr3Component")) + expect_equal(class_hierarchy_cache[["LearnerClassif"]], c("LearnerClassif", "Learner", "Mlr3Component")) + expect_equal(class_hierarchy_cache[["Learner"]], c("Learner", "Mlr3Component")) expect_false(isTRUE(all.equal(oldcache, class_hierarchy_cache))) From da990402fcea92b9a9233790928033de72e1467c Mon Sep 17 00:00:00 2001 From: mb706 Date: Thu, 14 Aug 2025 01:18:30 +0200 Subject: [PATCH 08/31] using po() syntax in tests VII --- tests/testthat/test_Graph.R | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/tests/testthat/test_Graph.R b/tests/testthat/test_Graph.R index b1885dfff..82006abdb 100644 --- a/tests/testthat/test_Graph.R +++ b/tests/testthat/test_Graph.R @@ -334,13 +334,15 @@ test_that("Intermediate results are saved to Graph if requested", { }) test_that("Namespaces get loaded", { - g = PipeOpPCA$new() %>>% PipeOpCopy$new(2) %>>% - gunion(list(PipeOpScale$new(), PipeOpNOP$new())) + g = po("pca") %>>% po("copy", 2) %>>% + gunion(list(po("scale"), po("nop"))) g$train(mlr_tasks$get("iris")) - g$pipeops$scale$packages = c("4rfjfw", "324r32") - g$pipeops$nop$packages = c("4rfjfw", "9422228u") + sprivate = g$pipeops$scale$.__enclos_env__$private + sprivate$.packages = c("4rfjfw", "324r32") + nprivate = g$pipeops$nop$.__enclos_env__$private + nprivate$.packages = c("4rfjfw", "9422228u") res = try(g$train(mlr_tasks$get("iris")), silent = TRUE) @@ -353,8 +355,8 @@ test_that("Namespaces get loaded", { }) test_that("Graph State", { - g = PipeOpPCA$new() %>>% PipeOpCopy$new(2) %>>% - gunion(list(PipeOpScale$new(), PipeOpNOP$new())) + g = po("pca") %>>% po("copy", 2) %>>% + gunion(list(po("scale"), po("nop"))) g_clone = g$clone(deep = TRUE) task = mlr_tasks$get("iris") @@ -370,9 +372,9 @@ test_that("Graph State", { test_that("Graph with vararg input", { t1 = tsk("iris") - t2 = PipeOpPCA$new()$train(list(t1))[[1]] - tcombined = PipeOpFeatureUnion$new()$train(list(t1, t2))[[1]] - gr = as_graph(PipeOpFeatureUnion$new()) + t2 = po("pca")$train(list(t1))[[1]] + tcombined = po("featureunion")$train(list(t1, t2))[[1]] + gr = as_graph(po("featureunion")) expect_equal(tcombined, gr$train(list(t1, t2), single_input = FALSE)[[1]]) expect_equal(tcombined, gr$predict(list(t1, t2), single_input = FALSE)[[1]]) From da0955a861578be805dd58dc62d92c9e7fa56480 Mon Sep 17 00:00:00 2001 From: mb706 Date: Thu, 14 Aug 2025 14:46:09 +0200 Subject: [PATCH 09/31] dict_entry --- R/PipeOpADAS.R | 2 +- R/PipeOpBLSmote.R | 2 +- R/PipeOpBoxCox.R | 2 +- R/PipeOpBranch.R | 2 +- R/PipeOpChunk.R | 2 +- R/PipeOpClassBalancing.R | 2 +- R/PipeOpClassWeights.R | 2 +- R/PipeOpClassifAvg.R | 2 +- R/PipeOpColApply.R | 2 +- R/PipeOpColRoles.R | 2 +- R/PipeOpCollapseFactors.R | 2 +- R/PipeOpCopy.R | 2 +- R/PipeOpDateFeatures.R | 2 +- R/PipeOpDecode.R | 2 +- R/PipeOpEncode.R | 2 +- R/PipeOpEncodeImpact.R | 2 +- R/PipeOpEncodeLmer.R | 2 +- R/PipeOpEncodePL.R | 8 ++++---- R/PipeOpEnsemble.R | 4 ++-- R/PipeOpFeatureUnion.R | 2 +- R/PipeOpFilter.R | 2 +- R/PipeOpFixFactors.R | 2 +- R/PipeOpHistBin.R | 2 +- R/PipeOpICA.R | 2 +- R/PipeOpImpute.R | 4 ++-- R/PipeOpImputeConstant.R | 2 +- R/PipeOpImputeHist.R | 2 +- R/PipeOpImputeLearner.R | 2 +- R/PipeOpImputeMean.R | 2 +- R/PipeOpImputeMedian.R | 2 +- R/PipeOpImputeMode.R | 2 +- R/PipeOpImputeOOR.R | 2 +- R/PipeOpImputeSample.R | 2 +- R/PipeOpKernelPCA.R | 2 +- R/PipeOpLearnerCV.R | 2 +- R/PipeOpLearnerPICVPlus.R | 10 +++++----- R/PipeOpLearnerQuantiles.R | 8 ++++---- R/PipeOpMissingIndicators.R | 2 +- R/PipeOpModelMatrix.R | 2 +- R/PipeOpMultiplicity.R | 6 +++--- R/PipeOpMutate.R | 2 +- R/PipeOpNMF.R | 2 +- R/PipeOpNOP.R | 2 +- R/PipeOpNearmiss.R | 2 +- R/PipeOpOVR.R | 4 ++-- R/PipeOpPCA.R | 2 +- R/PipeOpProxy.R | 2 +- R/PipeOpQuantileBin.R | 2 +- R/PipeOpRandomProjection.R | 2 +- R/PipeOpRandomResponse.R | 2 +- R/PipeOpRegrAvg.R | 2 +- R/PipeOpRemoveConstants.R | 2 +- R/PipeOpRenameColumns.R | 2 +- R/PipeOpRowApply.R | 2 +- R/PipeOpScale.R | 2 +- R/PipeOpScaleMaxAbs.R | 2 +- R/PipeOpScaleRange.R | 2 +- R/PipeOpSelect.R | 2 +- R/PipeOpSmote.R | 2 +- R/PipeOpSmoteNC.R | 2 +- R/PipeOpSpatialSign.R | 2 +- R/PipeOpSubsample.R | 2 +- R/PipeOpTaskPreproc.R | 4 ++-- R/PipeOpTextVectorizer.R | 2 +- R/PipeOpThreshold.R | 2 +- R/PipeOpTomek.R | 2 +- R/PipeOpTrafo.R | 10 +++++----- R/PipeOpTuneThreshold.R | 2 +- R/PipeOpUnbranch.R | 2 +- R/PipeOpVtreat.R | 2 +- R/PipeOpYeoJohnson.R | 2 +- tests/testthat/test_GraphLearner.R | 21 ++++++++++++++------- 72 files changed, 105 insertions(+), 98 deletions(-) diff --git a/R/PipeOpADAS.R b/R/PipeOpADAS.R index 80da72437..6c7c098e4 100644 --- a/R/PipeOpADAS.R +++ b/R/PipeOpADAS.R @@ -81,7 +81,7 @@ PipeOpADAS = R6Class("PipeOpADAS", K = p_int(lower = 1, default = 5, tags = c("train", "adas")) ) super$initialize(id, param_set = ps, param_vals = param_vals, can_subset_cols = FALSE, - packages = "smotefamily", task_type = "TaskClassif", tags = "imbalanced data") + packages = "smotefamily", task_type = "TaskClassif", tags = "imbalanced data", dict_entry = "adas") } ), private = list( diff --git a/R/PipeOpBLSmote.R b/R/PipeOpBLSmote.R index bb090820d..67b6fa1d5 100644 --- a/R/PipeOpBLSmote.R +++ b/R/PipeOpBLSmote.R @@ -93,7 +93,7 @@ PipeOpBLSmote = R6Class("PipeOpBLSmote", ) ps$values = list(quiet = TRUE) super$initialize(id, param_set = ps, param_vals = param_vals, can_subset_cols = FALSE, - packages = "smotefamily", task_type = "TaskClassif", tags = "imbalanced data") + packages = "smotefamily", task_type = "TaskClassif", tags = "imbalanced data", dict_entry = "blsmote") } ), private = list( diff --git a/R/PipeOpBoxCox.R b/R/PipeOpBoxCox.R index 53be3a148..3e188b69c 100644 --- a/R/PipeOpBoxCox.R +++ b/R/PipeOpBoxCox.R @@ -77,7 +77,7 @@ PipeOpBoxCox = R6Class("PipeOpBoxCox", upper = p_dbl(tags = c("train", "boxcox")) ) super$initialize(id, param_set = ps, param_vals = param_vals, - packages = "bestNormalize", feature_types = c("numeric", "integer")) + packages = "bestNormalize", feature_types = c("numeric", "integer"), dict_entry = "boxcox") } ), private = list( diff --git a/R/PipeOpBranch.R b/R/PipeOpBranch.R index e1930072b..a9ab77c9a 100644 --- a/R/PipeOpBranch.R +++ b/R/PipeOpBranch.R @@ -103,7 +103,7 @@ PipeOpBranch = R6Class("PipeOpBranch", super$initialize(id, ps, param_vals, input = data.table(name = "input", train = "*", predict = "*"), output = data.table(name = options, train = "*", predict = "*"), - tags = "meta" + tags = "meta", dict_entry = "branch" ) } ), diff --git a/R/PipeOpChunk.R b/R/PipeOpChunk.R index 023e4c1c1..64882777d 100644 --- a/R/PipeOpChunk.R +++ b/R/PipeOpChunk.R @@ -72,7 +72,7 @@ PipeOpChunk = R6Class("PipeOpChunk", param_set = ps, param_vals = param_vals, input = data.table(name = "input", train = "Task", predict = "Task"), output = data.table(name = rep_suffix("output", outnum), train = "Task", predict = "Task"), - tags = "meta" + tags = "meta", dict_entry = "chunk" ) } ), diff --git a/R/PipeOpClassBalancing.R b/R/PipeOpClassBalancing.R index 458404736..9e469bb2d 100644 --- a/R/PipeOpClassBalancing.R +++ b/R/PipeOpClassBalancing.R @@ -113,7 +113,7 @@ PipeOpClassBalancing = R6Class("PipeOpClassBalancing", shuffle = p_lgl(tags = "train") ) ps$values = list(ratio = 1, reference = "all", adjust = "all", shuffle = TRUE) - super$initialize(id, param_set = ps, param_vals = param_vals, can_subset_cols = FALSE, task_type = "TaskClassif", tags = "imbalanced data") + super$initialize(id, param_set = ps, param_vals = param_vals, can_subset_cols = FALSE, task_type = "TaskClassif", tags = "imbalanced data", dict_entry = "classbalancing") } ), private = list( diff --git a/R/PipeOpClassWeights.R b/R/PipeOpClassWeights.R index bf7588423..b1d9a7f41 100644 --- a/R/PipeOpClassWeights.R +++ b/R/PipeOpClassWeights.R @@ -87,7 +87,7 @@ PipeOpClassWeights = R6Class("PipeOpClassWeights", minor_weight = p_dbl(lower = 0, upper = Inf, tags = "train") ) ps$values = list(minor_weight = 1) - super$initialize(id, param_set = ps, param_vals = param_vals, can_subset_cols = FALSE, task_type = "TaskClassif", tags = "imbalanced data") + super$initialize(id, param_set = ps, param_vals = param_vals, can_subset_cols = FALSE, task_type = "TaskClassif", tags = "imbalanced data", dict_entry = "classweights") } ), private = list( diff --git a/R/PipeOpClassifAvg.R b/R/PipeOpClassifAvg.R index 6b61b8099..fe77a1799 100644 --- a/R/PipeOpClassifAvg.R +++ b/R/PipeOpClassifAvg.R @@ -81,7 +81,7 @@ PipeOpClassifAvg = R6Class("PipeOpClassifAvg", inherit = PipeOpEnsemble, public = list( initialize = function(innum = 0, collect_multiplicity = FALSE, id = "classifavg", param_vals = list()) { - super$initialize(innum, collect_multiplicity, id, param_vals = param_vals, prediction_type = "PredictionClassif", packages = "stats") + super$initialize(innum, collect_multiplicity, id, param_vals = param_vals, prediction_type = "PredictionClassif", packages = "stats", dict_entry = "classifavg") } ), private = list( diff --git a/R/PipeOpColApply.R b/R/PipeOpColApply.R index 6cac03132..20445cc6e 100644 --- a/R/PipeOpColApply.R +++ b/R/PipeOpColApply.R @@ -96,7 +96,7 @@ PipeOpColApply = R6Class("PipeOpColApply", applicator = p_uty(custom_check = check_function, tags = c("train", "predict")) ) ps$values = list(applicator = identity) - super$initialize(id, ps, param_vals = param_vals) + super$initialize(id, ps, param_vals = param_vals, dict_entry = "colapply") } ), private = list( diff --git a/R/PipeOpColRoles.R b/R/PipeOpColRoles.R index 5b446ea4b..26f5d78f3 100644 --- a/R/PipeOpColRoles.R +++ b/R/PipeOpColRoles.R @@ -121,7 +121,7 @@ PipeOpColRoles = R6Class("PipeOpColRoles", }) ) ) - super$initialize(id, param_set = ps, param_vals = param_vals, can_subset_cols = FALSE) + super$initialize(id, param_set = ps, param_vals = param_vals, can_subset_cols = FALSE, dict_entry = "colroles") } ), private = list( diff --git a/R/PipeOpCollapseFactors.R b/R/PipeOpCollapseFactors.R index c23b3c01a..7b794e26b 100644 --- a/R/PipeOpCollapseFactors.R +++ b/R/PipeOpCollapseFactors.R @@ -99,7 +99,7 @@ PipeOpCollapseFactors = R6Class("PipeOpCollapseFactors", target_level_count = p_int(2, tags = c("train", "predict")) ) ps$values = list(no_collapse_above_prevalence = 1, no_collapse_above_absolute = Inf, target_level_count = 2) - super$initialize(id, param_set = ps, param_vals = param_vals, feature_types = c("factor", "ordered")) + super$initialize(id, param_set = ps, param_vals = param_vals, feature_types = c("factor", "ordered"), dict_entry = "collapsefactors") } ), private = list( diff --git a/R/PipeOpCopy.R b/R/PipeOpCopy.R index f69a82065..92b14ce59 100644 --- a/R/PipeOpCopy.R +++ b/R/PipeOpCopy.R @@ -86,7 +86,7 @@ PipeOpCopy = R6Class("PipeOpCopy", super$initialize(id, param_vals = param_vals, input = data.table(name = "input", train = "*", predict = "*"), output = data.table(name = rep_suffix("output", outnum), train = "*", predict = "*"), - tags = "meta" + tags = "meta", dict_entry = "copy" ) } ), diff --git a/R/PipeOpDateFeatures.R b/R/PipeOpDateFeatures.R index 4445f6f8f..cd286aca8 100644 --- a/R/PipeOpDateFeatures.R +++ b/R/PipeOpDateFeatures.R @@ -116,7 +116,7 @@ PipeOpDateFeatures = R6Class("PipeOpDateFeatures", ps$values = list(keep_date_var = FALSE, cyclic = FALSE, year = TRUE, month = TRUE, week_of_year = TRUE, day_of_year = TRUE, day_of_month = TRUE, day_of_week = TRUE, hour = TRUE, minute = TRUE, second = TRUE, is_day = TRUE) - super$initialize(id = id, param_set = ps, param_vals = param_vals, feature_types = "POSIXct") + super$initialize(id = id, param_set = ps, param_vals = param_vals, feature_types = "POSIXct", dict_entry = "datefeatures") } ), private = list( diff --git a/R/PipeOpDecode.R b/R/PipeOpDecode.R index 820de585c..5e72f245c 100644 --- a/R/PipeOpDecode.R +++ b/R/PipeOpDecode.R @@ -147,7 +147,7 @@ PipeOpDecode = R6Class("PipeOpDecode", ties_method = p_fct(c("first", "last", "random"), tags = c("train", "required")) ) ps$values = list(treatment_encoding = FALSE, group_pattern = "^([^.]+)\\.", ties_method = "random") - super$initialize(id, param_set = ps, param_vals = param_vals, tags = "encode", feature_types = c("integer", "numeric")) + super$initialize(id, param_set = ps, param_vals = param_vals, tags = "encode", feature_types = c("integer", "numeric"), dict_entry = "decode") } ), private = list( diff --git a/R/PipeOpEncode.R b/R/PipeOpEncode.R index f588ae747..753c399f3 100644 --- a/R/PipeOpEncode.R +++ b/R/PipeOpEncode.R @@ -100,7 +100,7 @@ PipeOpEncode = R6Class("PipeOpEncode", method = p_fct(levels = c("one-hot", "treatment", "helmert", "poly", "sum"), tags = c("train", "predict")) ) ps$values = list(method = "one-hot") - super$initialize(id, param_set = ps, param_vals = param_vals, packages = "stats", tags = "encode", feature_types = c("factor", "ordered")) + super$initialize(id, param_set = ps, param_vals = param_vals, packages = "stats", tags = "encode", feature_types = c("factor", "ordered"), dict_entry = "encode") } ), private = list( diff --git a/R/PipeOpEncodeImpact.R b/R/PipeOpEncodeImpact.R index 31116d80d..eac433a0f 100644 --- a/R/PipeOpEncodeImpact.R +++ b/R/PipeOpEncodeImpact.R @@ -87,7 +87,7 @@ PipeOpEncodeImpact = R6Class("PipeOpEncodeImpact", ) ps$values = list(smoothing = 1e-4, impute_zero = FALSE) super$initialize(id, param_set = ps, param_vals = param_vals, task_type = "TaskSupervised", tags = "encode", - feature_types = c("factor", "ordered")) + feature_types = c("factor", "ordered"), dict_entry = "encodeimpact") } ), private = list( diff --git a/R/PipeOpEncodeLmer.R b/R/PipeOpEncodeLmer.R index f38f15f90..eaf624571 100644 --- a/R/PipeOpEncodeLmer.R +++ b/R/PipeOpEncodeLmer.R @@ -97,7 +97,7 @@ PipeOpEncodeLmer = R6Class("PipeOpEncodeLmer", ) ps$values = list(fast_optim = TRUE) super$initialize(id, param_set = ps, param_vals = param_vals, packages = c("lme4", "nloptr"), - task_type = "TaskSupervised", tags = "encode", feature_types = c("factor", "ordered")) + task_type = "TaskSupervised", tags = "encode", feature_types = c("factor", "ordered"), dict_entry = "encodelmer") } ), private = list( diff --git a/R/PipeOpEncodePL.R b/R/PipeOpEncodePL.R index 3eef75716..b5d75faf5 100644 --- a/R/PipeOpEncodePL.R +++ b/R/PipeOpEncodePL.R @@ -78,9 +78,9 @@ PipeOpEncodePL = R6Class("PipeOpEncodePL", inherit = PipeOpTaskPreprocSimple, public = list( - initialize = function(id, param_set = ps(), param_vals = list(), packages = character(0), task_type = "Task") { + initialize = function(id, param_set = ps(), param_vals = list(), packages = character(0), task_type = "Task", dict_entry = id) { super$initialize(id = id, param_set = param_set, param_vals = param_vals, packages = packages, - task_type = task_type, tags = "encode", feature_types = c("numeric", "integer")) + task_type = task_type, tags = "encode", feature_types = c("numeric", "integer"), dict_entry = dict_entry) } ), private = list( @@ -228,7 +228,7 @@ PipeOpEncodePLQuantiles = R6Class("PipeOpEncodePLQuantiles", numsplits = p_int(lower = 2, init = 2, tags = c("train", "predict", "required")), type = p_int(lower = 1, upper = 9, default = 7, tags = c("train", "predict")) ) - super$initialize(id, param_set = ps, param_vals = param_vals, packages = "stats") + super$initialize(id, param_set = ps, param_vals = param_vals, packages = "stats", dict_entry = "encodeplquantiles") } ), private = list( @@ -360,7 +360,7 @@ PipeOpEncodePLTree = R6Class("PipeOpEncodePLTree", } super$initialize(id, param_set = alist(private$.tree_learner$param_set), param_vals = param_vals, - packages = private$.tree_learner$packages, task_type = task_type) + packages = private$.tree_learner$packages, task_type = task_type, dict_entry = "encodepltree") } ), private = list( diff --git a/R/PipeOpEnsemble.R b/R/PipeOpEnsemble.R index a93acdcf6..7227e959c 100644 --- a/R/PipeOpEnsemble.R +++ b/R/PipeOpEnsemble.R @@ -82,7 +82,7 @@ PipeOpEnsemble = R6Class("PipeOpEnsemble", inherit = PipeOp, public = list( - initialize = function(innum = 0, collect_multiplicity = FALSE, id, param_set = ps(), param_vals = list(), packages = character(0), prediction_type = "Prediction", tags = NULL) { + initialize = function(innum = 0, collect_multiplicity = FALSE, id, param_set = ps(), param_vals = list(), packages = character(0), prediction_type = "Prediction", tags = NULL, dict_entry = id) { assert_integerish(innum, lower = 0) param_set = c(param_set, ps(weights = p_uty(check_weights(innum), tags = "predict"))) param_set$values$weights = 1 @@ -99,7 +99,7 @@ PipeOpEnsemble = R6Class("PipeOpEnsemble", super$initialize(id, param_set = param_set, param_vals = param_vals, packages = packages, input = data.table(name = inname, train = intype[[1]], predict = intype[[2]]), output = data.table(name = "output", train = "NULL", predict = prediction_type), - tags = c(tags, "ensemble") + tags = c(tags, "ensemble"), dict_entry = dict_entry ) } ), diff --git a/R/PipeOpFeatureUnion.R b/R/PipeOpFeatureUnion.R index 79771afff..70d919a2e 100644 --- a/R/PipeOpFeatureUnion.R +++ b/R/PipeOpFeatureUnion.R @@ -127,7 +127,7 @@ PipeOpFeatureUnion = R6Class("PipeOpFeatureUnion", super$initialize(id, param_vals = param_vals, input = data.table(name = inname, train = intype, predict = intype), output = data.table(name = "output", train = "Task", predict = "Task"), - tags = "ensemble" + tags = "ensemble", dict_entry = "featureunion" ) } ), diff --git a/R/PipeOpFilter.R b/R/PipeOpFilter.R index b5e8fd88d..0f3381903 100644 --- a/R/PipeOpFilter.R +++ b/R/PipeOpFilter.R @@ -124,7 +124,7 @@ PipeOpFilter = R6Class("PipeOpFilter", cutoff = p_dbl(tags = "train"), permuted = p_int(lower = 1, tags = "train") ) - super$initialize(id, alist(filter = private$.outer_param_set, self$filter$param_set), param_vals = param_vals, tags = "feature selection") + super$initialize(id, alist(filter = private$.outer_param_set, self$filter$param_set), param_vals = param_vals, tags = "feature selection", dict_entry = "filter") } ), private = list( diff --git a/R/PipeOpFixFactors.R b/R/PipeOpFixFactors.R index 495900b18..ca8a78e95 100644 --- a/R/PipeOpFixFactors.R +++ b/R/PipeOpFixFactors.R @@ -59,7 +59,7 @@ PipeOpFixFactors = R6Class("PipeOpFixFactors", droplevels = p_lgl(tags = c("train", "predict")) ) ps$values = list(droplevels = TRUE) - super$initialize(id, param_set = ps, param_vals = param_vals, tags = "robustify", feature_types = c("factor", "ordered")) + super$initialize(id, param_set = ps, param_vals = param_vals, tags = "robustify", feature_types = c("factor", "ordered"), dict_entry = "fixfactors") } ), private = list( diff --git a/R/PipeOpHistBin.R b/R/PipeOpHistBin.R index 2eaefcca3..358463b55 100644 --- a/R/PipeOpHistBin.R +++ b/R/PipeOpHistBin.R @@ -70,7 +70,7 @@ PipeOpHistBin = R6Class("PipeOpHistBin", ps = ps( breaks = p_uty(default = "Sturges", tags = c("train", "hist")) ) - super$initialize(id, param_set = ps, param_vals = param_vals, packages = "graphics", feature_types = c("numeric", "integer")) + super$initialize(id, param_set = ps, param_vals = param_vals, packages = "graphics", feature_types = c("numeric", "integer"), dict_entry = "histbin") } ), private = list( diff --git a/R/PipeOpICA.R b/R/PipeOpICA.R index c6b71a1ba..bc356b964 100644 --- a/R/PipeOpICA.R +++ b/R/PipeOpICA.R @@ -108,7 +108,7 @@ PipeOpICA = R6Class("PipeOpICA", ) ps$values = list(method = "C") super$initialize(id, param_set = ps, param_vals = param_vals, - packages = "fastICA", feature_types = c("numeric", "integer")) + packages = "fastICA", feature_types = c("numeric", "integer"), dict_entry = "ica") } ), private = list( diff --git a/R/PipeOpImpute.R b/R/PipeOpImpute.R index 087435ed1..59e440bc0 100644 --- a/R/PipeOpImpute.R +++ b/R/PipeOpImpute.R @@ -145,7 +145,7 @@ PipeOpImpute = R6Class("PipeOpImpute", public = list( initialize = function(id, param_set = ps(), param_vals = list(), whole_task_dependent = FALSE, empty_level_control = "never", - packages = character(0), task_type = "Task", feature_types = mlr_reflections$task_feature_types) { + packages = character(0), task_type = "Task", feature_types = mlr_reflections$task_feature_types, dict_entry = id) { # Add one or two parameters: affect_columns (always) and context_columns (if whole_task_dependent is TRUE) addparams = list(affect_columns = p_uty(custom_check = check_function_or_null, tags = "train")) if (whole_task_dependent) { @@ -180,7 +180,7 @@ PipeOpImpute = R6Class("PipeOpImpute", super$initialize(id = id, param_set = param_set, param_vals = param_vals, input = data.table(name = "input", train = task_type, predict = task_type), output = data.table(name = "output", train = task_type, predict = task_type), - packages = packages, tags = "missings" + packages = packages, tags = "missings", dict_entry = dict_entry ) } diff --git a/R/PipeOpImputeConstant.R b/R/PipeOpImputeConstant.R index fd47a3424..2c49efa53 100644 --- a/R/PipeOpImputeConstant.R +++ b/R/PipeOpImputeConstant.R @@ -83,7 +83,7 @@ PipeOpImputeConstant = R6Class("PipeOpImputeConstant", check_levels = p_lgl(init = TRUE, tags = c("train", "required")) ) super$initialize(id, param_set = ps, param_vals = param_vals, empty_level_control = "always", - feature_types = c("logical", "integer", "numeric", "character", "factor", "ordered", "POSIXct")) + feature_types = c("logical", "integer", "numeric", "character", "factor", "ordered", "POSIXct"), dict_entry = "imputeconstant") } ), private = list( diff --git a/R/PipeOpImputeHist.R b/R/PipeOpImputeHist.R index 389eb870f..3433dd599 100644 --- a/R/PipeOpImputeHist.R +++ b/R/PipeOpImputeHist.R @@ -66,7 +66,7 @@ PipeOpImputeHist = R6Class("PipeOpImputeHist", inherit = PipeOpImpute, public = list( initialize = function(id = "imputehist", param_vals = list()) { - super$initialize(id, param_vals = param_vals, packages = "graphics", feature_types = c("integer", "numeric")) + super$initialize(id, param_vals = param_vals, packages = "graphics", feature_types = c("integer", "numeric"), dict_entry = "imputehist") } ), private = list( diff --git a/R/PipeOpImputeLearner.R b/R/PipeOpImputeLearner.R index 50159924a..647f217d2 100644 --- a/R/PipeOpImputeLearner.R +++ b/R/PipeOpImputeLearner.R @@ -112,7 +112,7 @@ PipeOpImputeLearner = R6Class("PipeOpImputeLearner", # with generative text models, but by the time R/mlr3 can do that it is probably post-singularity. ) super$initialize(id, param_set = alist(private$.learner$param_set), param_vals = param_vals, - whole_task_dependent = TRUE, feature_types = feature_types) + whole_task_dependent = TRUE, feature_types = feature_types, dict_entry = "imputelearner") } ), active = list( diff --git a/R/PipeOpImputeMean.R b/R/PipeOpImputeMean.R index 90274516a..f8a4a7d8f 100644 --- a/R/PipeOpImputeMean.R +++ b/R/PipeOpImputeMean.R @@ -59,7 +59,7 @@ PipeOpImputeMean = R6Class("PipeOpImputeMean", inherit = PipeOpImpute, public = list( initialize = function(id = "imputemean", param_vals = list()) { - super$initialize(id, param_vals = param_vals, feature_types= c("numeric", "integer")) + super$initialize(id, param_vals = param_vals, feature_types= c("numeric", "integer"), dict_entry = "imputemean") } ), private = list( diff --git a/R/PipeOpImputeMedian.R b/R/PipeOpImputeMedian.R index 0113b3565..c3147353b 100644 --- a/R/PipeOpImputeMedian.R +++ b/R/PipeOpImputeMedian.R @@ -59,7 +59,7 @@ PipeOpImputeMedian = R6Class("PipeOpImputeMedian", inherit = PipeOpImpute, public = list( initialize = function(id = "imputemedian", param_vals = list()) { - super$initialize(id, param_vals = param_vals, packages = "stats", feature_types = c("numeric", "integer")) + super$initialize(id, param_vals = param_vals, packages = "stats", feature_types = c("numeric", "integer"), dict_entry = "imputemedian") } ), private = list( diff --git a/R/PipeOpImputeMode.R b/R/PipeOpImputeMode.R index bdef94cde..cd0a8f09e 100644 --- a/R/PipeOpImputeMode.R +++ b/R/PipeOpImputeMode.R @@ -66,7 +66,7 @@ PipeOpImputeMode = R6Class("PipeOpImputeMode", inherit = PipeOpImpute, public = list( initialize = function(id = "imputemode", param_vals = list()) { - super$initialize(id, param_vals = param_vals, feature_types = c("factor", "integer", "logical", "numeric", "ordered")) + super$initialize(id, param_vals = param_vals, feature_types = c("factor", "integer", "logical", "numeric", "ordered"), dict_entry = "imputemode") } ), private = list( diff --git a/R/PipeOpImputeOOR.R b/R/PipeOpImputeOOR.R index f1037cc51..376216d38 100644 --- a/R/PipeOpImputeOOR.R +++ b/R/PipeOpImputeOOR.R @@ -119,7 +119,7 @@ PipeOpImputeOOR = R6Class("PipeOpImputeOOR", ) # this is one of the few imputers that handles 'character' features! super$initialize(id, param_set = ps, param_vals = param_vals, empty_level_control = "param", - feature_types = c("character", "factor", "integer", "numeric", "ordered")) + feature_types = c("character", "factor", "integer", "numeric", "ordered"), dict_entry = "imputeoor") } ), private = list( diff --git a/R/PipeOpImputeSample.R b/R/PipeOpImputeSample.R index 214998728..7c10c6612 100644 --- a/R/PipeOpImputeSample.R +++ b/R/PipeOpImputeSample.R @@ -61,7 +61,7 @@ PipeOpImputeSample = R6Class("PipeOpImputeSample", inherit = PipeOpImpute, public = list( initialize = function(id = "imputesample", param_vals = list()) { - super$initialize(id, param_vals = param_vals, feature_types = c("factor", "integer", "logical", "numeric", "ordered")) + super$initialize(id, param_vals = param_vals, feature_types = c("factor", "integer", "logical", "numeric", "ordered"), dict_entry = "imputesample") } ), private = list( diff --git a/R/PipeOpKernelPCA.R b/R/PipeOpKernelPCA.R index d9b115d8a..86347e357 100644 --- a/R/PipeOpKernelPCA.R +++ b/R/PipeOpKernelPCA.R @@ -79,7 +79,7 @@ PipeOpKernelPCA = R6Class("PipeOpKernelPCA", na.action = p_uty(default = stats::na.omit, tags = c("train", "kpca")) ) super$initialize(id, param_set = ps, param_vals = param_vals, - packages = "kernlab", feature_types = c("numeric", "integer")) + packages = "kernlab", feature_types = c("numeric", "integer"), dict_entry = "kernelpca") } ), private = list( diff --git a/R/PipeOpLearnerCV.R b/R/PipeOpLearnerCV.R index 644aba548..dcc4b0693 100644 --- a/R/PipeOpLearnerCV.R +++ b/R/PipeOpLearnerCV.R @@ -137,7 +137,7 @@ PipeOpLearnerCV = R6Class("PipeOpLearnerCV", # in PipeOp ParamSets. # private$.crossval_param_set$add_dep("folds", "method", CondEqual$new("cv")) # don't do this. - super$initialize(id, alist(resampling = private$.crossval_param_set, private$.learner$param_set), param_vals = param_vals, can_subset_cols = TRUE, task_type = task_type, tags = c("learner", "ensemble")) + super$initialize(id, alist(resampling = private$.crossval_param_set, private$.learner$param_set), param_vals = param_vals, can_subset_cols = TRUE, task_type = task_type, tags = c("learner", "ensemble"), dict_entry = "learner_cv") } ), diff --git a/R/PipeOpLearnerPICVPlus.R b/R/PipeOpLearnerPICVPlus.R index 979878f00..764833e01 100644 --- a/R/PipeOpLearnerPICVPlus.R +++ b/R/PipeOpLearnerPICVPlus.R @@ -116,11 +116,11 @@ PipeOpLearnerPICVPlus = R6Class("PipeOpLearnerPICVPlus", private$.picvplus_param_set$values = list(folds = 3, alpha = 0.05) # default super$initialize(id, param_set = alist(picvplus = private$.picvplus_param_set, private$.learner$param_set), - param_vals = param_vals, - input = data.table(name = "input", train = task_type, predict = task_type), - output = data.table(name = "output", train = "NULL", predict = out_type), - packages = learner$packages, - tags = c("learner", "ensemble") + param_vals = param_vals, + input = data.table(name = "input", train = task_type, predict = task_type), + output = data.table(name = "output", train = "NULL", predict = out_type), + packages = learner$packages, + tags = c("learner", "ensemble"), dict_entry = "learner_pi_cvplus" ) } ), diff --git a/R/PipeOpLearnerQuantiles.R b/R/PipeOpLearnerQuantiles.R index c180b75bd..9706e53cf 100644 --- a/R/PipeOpLearnerQuantiles.R +++ b/R/PipeOpLearnerQuantiles.R @@ -109,10 +109,10 @@ PipeOpLearnerQuantiles = R6Class("PipeOpLearnerQuantiles", private$.quantiles_param_set$values = list(q_vals = c(0.05, 0.5, 0.95), q_response = 0.5) # default super$initialize(id, param_set = alist(quantiles = private$.quantiles_param_set, private$.learner$param_set), - param_vals = param_vals, - input = data.table(name = "input", train = task_type, predict = task_type), - output = data.table(name = "output", train = "NULL", predict = out_type), - packages = learner$packages, tags = c("learner", "ensemble") + param_vals = param_vals, + input = data.table(name = "input", train = task_type, predict = task_type), + output = data.table(name = "output", train = "NULL", predict = out_type), + packages = learner$packages, tags = c("learner", "ensemble"), dict_entry = "learner_quantiles" ) } ), diff --git a/R/PipeOpMissingIndicators.R b/R/PipeOpMissingIndicators.R index d3858ccfe..1f0a898fb 100644 --- a/R/PipeOpMissingIndicators.R +++ b/R/PipeOpMissingIndicators.R @@ -84,7 +84,7 @@ PipeOpMissInd = R6Class("PipeOpMissInd", type = p_fct(levels = c("factor", "integer", "logical", "numeric"), tags = c("train", "predict", "required")) ) ps$values = list(which = "missing_train", type = "factor") - super$initialize(id, ps, param_vals = param_vals, tags = "missings") + super$initialize(id, ps, param_vals = param_vals, tags = "missings", dict_entry = "missind") if ("affect_columns" %nin% names(param_vals)) { # can't put this in `ps$values` because it is a PipeOpTaskPreproc param self$param_set$values$affect_columns = selector_invert(selector_type(c("factor", "ordered", "character"))) diff --git a/R/PipeOpModelMatrix.R b/R/PipeOpModelMatrix.R index 8bd9ad28e..d825e2c3f 100644 --- a/R/PipeOpModelMatrix.R +++ b/R/PipeOpModelMatrix.R @@ -65,7 +65,7 @@ PipeOpModelMatrix = R6Class("PipeOpModelMatrix", ps = ps( formula = p_uty(tags = c("train", "predict"), custom_check = check_formula) ) - super$initialize(id, param_set = ps, param_vals = param_vals, packages = "stats") + super$initialize(id, param_set = ps, param_vals = param_vals, packages = "stats", dict_entry = "modelmatrix") } ), private = list( diff --git a/R/PipeOpMultiplicity.R b/R/PipeOpMultiplicity.R index d3fd79222..3ef5c39e7 100644 --- a/R/PipeOpMultiplicity.R +++ b/R/PipeOpMultiplicity.R @@ -88,7 +88,7 @@ PipeOpMultiplicityImply = R6Class("PipeOpMultiplicityImply", super$initialize(id, param_vals = param_vals, input = data.table(name = inname, train = "*", predict = "*"), output = data.table(name = "output", train = "[*]", predict = "[*]"), - tags = "multiplicity" + tags = "multiplicity", dict_entry = "multiplicityimply" ) } ), @@ -182,7 +182,7 @@ PipeOpMultiplicityExply = R6Class("PipeOpMultiplicityExply", super$initialize(id, param_vals = param_vals, input = data.table(name = "input", train = "[*]", predict = "[*]"), output = data.table(name = rep_suffix("output", outnum), train = "*", predict = "*"), - tags = "multiplicity" + tags = "multiplicity", dict_entry = "multiplicityexply" ) } ), @@ -267,7 +267,7 @@ PipeOpReplicate = R6Class("PipeOpReplicate", super$initialize(id, param_set = ps, param_vals = param_vals, input = data.table(name = "input", train = "*", predict = "*"), output = data.table(name = "output", train = "[*]", predict = "[*]"), - tags = "multiplicity" + tags = "multiplicity", dict_entry = "replicate" ) } ), diff --git a/R/PipeOpMutate.R b/R/PipeOpMutate.R index 093a24ea4..7878f2112 100644 --- a/R/PipeOpMutate.R +++ b/R/PipeOpMutate.R @@ -78,7 +78,7 @@ PipeOpMutate = R6Class("PipeOpMutate", delete_originals = p_lgl(tags = c("train", "predict", "required")) ) ps$values = list(mutation = list(), delete_originals = FALSE) - super$initialize(id, ps, param_vals = param_vals) + super$initialize(id, ps, param_vals = param_vals, dict_entry = "mutate") } ), private = list( diff --git a/R/PipeOpNMF.R b/R/PipeOpNMF.R index 061875753..b9825901f 100644 --- a/R/PipeOpNMF.R +++ b/R/PipeOpNMF.R @@ -133,7 +133,7 @@ PipeOpNMF = R6Class("PipeOpNMF", callback = p_uty(tags = c("train", "nmf"), depends = quote(keep.all == TRUE)) # .callback ) ps$values = list(rank = 2L, method = "brunet", parallel = FALSE, parallel.required = FALSE) - super$initialize(id, param_set = ps, param_vals = param_vals, feature_types = c("numeric", "integer"), packages = c("MASS", "NMF")) + super$initialize(id, param_set = ps, param_vals = param_vals, feature_types = c("numeric", "integer"), packages = c("MASS", "NMF"), dict_entry = "nmf") } ), private = list( diff --git a/R/PipeOpNOP.R b/R/PipeOpNOP.R index 7353f4e1c..2a0fa610c 100644 --- a/R/PipeOpNOP.R +++ b/R/PipeOpNOP.R @@ -64,7 +64,7 @@ PipeOpNOP = R6Class("PipeOpNOP", super$initialize(id, param_vals = param_vals, input = data.table(name = "input", train = "*", predict = "*"), output = data.table(name = "output", train = "*", predict = "*"), - tags = "meta" + tags = "meta", dict_entry = "nop" ) } ), diff --git a/R/PipeOpNearmiss.R b/R/PipeOpNearmiss.R index 8ea5b72ec..cf4f6e852 100644 --- a/R/PipeOpNearmiss.R +++ b/R/PipeOpNearmiss.R @@ -78,7 +78,7 @@ PipeOpNearmiss = R6Class("PipeOpNearmiss", under_ratio = p_dbl(lower = 0, default = 1, tags = c("train", "nearmiss")) ) super$initialize(id, param_set = ps, param_vals = param_vals, packages = "themis", can_subset_cols = FALSE, - task_type = "TaskClassif", tags = "imbalanced data") + task_type = "TaskClassif", tags = "imbalanced data", dict_entry = "nearmiss") } ), private = list( diff --git a/R/PipeOpOVR.R b/R/PipeOpOVR.R index d1cad2794..40e9d5a4b 100644 --- a/R/PipeOpOVR.R +++ b/R/PipeOpOVR.R @@ -81,7 +81,7 @@ PipeOpOVRSplit = R6Class("PipeOpOVRSplit", super$initialize(id, param_vals = param_vals, input = data.table(name = "input", train = "TaskClassif", predict = "TaskClassif"), output = data.table(name = "output", train = "[TaskClassif]", predict = "[TaskClassif]"), - tags = c("target transform", "multiplicity") + tags = c("target transform", "multiplicity"), dict_entry = "ovrsplit" ) } ), @@ -186,7 +186,7 @@ PipeOpOVRUnite = R6Class("PipeOpOVRUnite", inherit = PipeOpEnsemble, public = list( initialize = function(id = "ovrunite", param_vals = list()) { - super$initialize(0, TRUE, id, param_vals = param_vals, prediction_type = "PredictionClassif", tags = "multiplicity") + super$initialize(0, TRUE, id, param_vals = param_vals, prediction_type = "PredictionClassif", tags = "multiplicity", dict_entry = "ovrunite") } ), private = list( diff --git a/R/PipeOpPCA.R b/R/PipeOpPCA.R index 0080b9185..e0068dc5b 100644 --- a/R/PipeOpPCA.R +++ b/R/PipeOpPCA.R @@ -76,7 +76,7 @@ PipeOpPCA = R6Class("PipeOpPCA", scale. = p_lgl(default = FALSE, tags = c("train", "pca")), rank. = p_int(default = NULL, lower = 1, upper = Inf, special_vals = list(NULL), tags = c("train", "pca")) ) - super$initialize(id = "pca", param_set = ps, param_vals = param_vals, feature_types = c("numeric", "integer")) + super$initialize(id = id, dict_entry = "pca", param_set = ps, param_vals = param_vals, feature_types = c("numeric", "integer")) } ), private = list( diff --git a/R/PipeOpProxy.R b/R/PipeOpProxy.R index a79819ef2..01a04aa9b 100644 --- a/R/PipeOpProxy.R +++ b/R/PipeOpProxy.R @@ -111,7 +111,7 @@ PipeOpProxy = R6Class("PipeOpProxy", super$initialize(id, param_set = ps, param_vals = param_vals, input = data.table(name = inname, train = "*", predict = "*"), output = data.table(name = rep_suffix("output", outnum), train = "*", predict = "*"), - tags = "meta" + tags = "meta", dict_entry = "proxy" ) } ), diff --git a/R/PipeOpQuantileBin.R b/R/PipeOpQuantileBin.R index 1e124f828..81bd485a1 100644 --- a/R/PipeOpQuantileBin.R +++ b/R/PipeOpQuantileBin.R @@ -63,7 +63,7 @@ PipeOpQuantileBin = R6Class("PipeOpQuantileBin", numsplits = p_int(lower = 2, special_vals = list(NULL), tags = "train") ) ps$values = list(numsplits = 2L) - super$initialize(id, param_set = ps, param_vals = param_vals, packages = "stats", feature_types = c("numeric", "integer")) + super$initialize(id, param_set = ps, param_vals = param_vals, packages = "stats", feature_types = c("numeric", "integer"), dict_entry = "quantilebin") } ), private = list( diff --git a/R/PipeOpRandomProjection.R b/R/PipeOpRandomProjection.R index 7249dd334..4e701fe9c 100644 --- a/R/PipeOpRandomProjection.R +++ b/R/PipeOpRandomProjection.R @@ -77,7 +77,7 @@ PipeOpRandomProjection = R6Class("PipeOpRandomProjection", rank = p_int(lower = 0, tags = "train") ) ps$values = list(rank = 1) - super$initialize(id, param_set = ps, param_vals = param_vals, feature_types = c("numeric", "integer")) + super$initialize(id, param_set = ps, param_vals = param_vals, feature_types = c("numeric", "integer"), dict_entry = "randomprojection") } ), private = list( diff --git a/R/PipeOpRandomResponse.R b/R/PipeOpRandomResponse.R index 6aeddb0ba..4a968f4fc 100644 --- a/R/PipeOpRandomResponse.R +++ b/R/PipeOpRandomResponse.R @@ -91,7 +91,7 @@ PipeOpRandomResponse = R6Class("PipeOpRandomResponse", ps$values = list(rdistfun = stats::rnorm) super$initialize(id = id, param_set = ps, param_vals = param_vals, packages = packages, input = data.table(name = "input", train = "NULL", predict = "Prediction"), - output = data.table(name = "output", train = "NULL", predict = "Prediction") + output = data.table(name = "output", train = "NULL", predict = "Prediction"), dict_entry = "randomresponse" ) } ), diff --git a/R/PipeOpRegrAvg.R b/R/PipeOpRegrAvg.R index 69cd972a2..f068cda7a 100644 --- a/R/PipeOpRegrAvg.R +++ b/R/PipeOpRegrAvg.R @@ -74,7 +74,7 @@ PipeOpRegrAvg = R6Class("PipeOpRegrAvg", public = list( initialize = function(innum = 0, collect_multiplicity = FALSE, id = "regravg", param_vals = list(), ...) { - super$initialize(innum, collect_multiplicity, id, param_vals = param_vals, prediction_type = "PredictionRegr", ...) + super$initialize(innum, collect_multiplicity, id, param_vals = param_vals, prediction_type = "PredictionRegr", ..., dict_entry = "regravg") } ), private = list( diff --git a/R/PipeOpRemoveConstants.R b/R/PipeOpRemoveConstants.R index f6237a431..eac33e320 100644 --- a/R/PipeOpRemoveConstants.R +++ b/R/PipeOpRemoveConstants.R @@ -70,7 +70,7 @@ PipeOpRemoveConstants = R6Class("PipeOpRemoveConstants", na_ignore = p_lgl(tags = c("train", "required", "constant_check")) ) ps$values = list(ratio = 0, rel_tol = 1e-8, abs_tol = 1e-8, na_ignore = TRUE) - super$initialize(id, param_set = ps, param_vals = param_vals, tags = "robustify") + super$initialize(id, param_set = ps, param_vals = param_vals, tags = "robustify", dict_entry = "removeconstants") } ), private = list( diff --git a/R/PipeOpRenameColumns.R b/R/PipeOpRenameColumns.R index b7d175e56..f3c8c3748 100644 --- a/R/PipeOpRenameColumns.R +++ b/R/PipeOpRenameColumns.R @@ -69,7 +69,7 @@ PipeOpRenameColumns = R6Class("PipeOpRenameColumns", ignore_missing = p_lgl(tags = c("train", "predict", "required")) ) ps$values = list(renaming = character(0), ignore_missing = FALSE) - super$initialize(id, ps, param_vals = param_vals, can_subset_cols = FALSE) + super$initialize(id, ps, param_vals = param_vals, can_subset_cols = FALSE, dict_entry = "renamecolumns") } ), private = list( diff --git a/R/PipeOpRowApply.R b/R/PipeOpRowApply.R index e697f0137..7951de30b 100644 --- a/R/PipeOpRowApply.R +++ b/R/PipeOpRowApply.R @@ -67,7 +67,7 @@ PipeOpRowApply = R6Class("PipeOpRowApply", applicator = identity, col_prefix = "" ) - super$initialize(id, ps, param_vals = param_vals, feature_types = c("numeric", "integer")) + super$initialize(id, ps, param_vals = param_vals, feature_types = c("numeric", "integer"), dict_entry = "rowapply") } ), private = list( diff --git a/R/PipeOpScale.R b/R/PipeOpScale.R index 28ba37f2d..82ba1c6cf 100644 --- a/R/PipeOpScale.R +++ b/R/PipeOpScale.R @@ -84,7 +84,7 @@ PipeOpScale = R6Class("PipeOpScale", robust = p_lgl(tags = c("train", "required")) ) ps$values = list(robust = FALSE) - super$initialize(id = id, param_set = ps, param_vals = param_vals, feature_types = c("numeric", "integer")) + super$initialize(id = id, param_set = ps, param_vals = param_vals, feature_types = c("numeric", "integer"), dict_entry = "scale") } ), private = list( diff --git a/R/PipeOpScaleMaxAbs.R b/R/PipeOpScaleMaxAbs.R index 6fbaa3285..770ea4b56 100644 --- a/R/PipeOpScaleMaxAbs.R +++ b/R/PipeOpScaleMaxAbs.R @@ -58,7 +58,7 @@ PipeOpScaleMaxAbs = R6Class("PipeOpScaleMaxAbs", maxabs = p_dbl(lower = 0, tags = c("required", "train", "predict")) ) ps$values = list(maxabs = 1) - super$initialize(id, param_set = ps, param_vals = param_vals, feature_types = c("numeric", "integer")) + super$initialize(id, param_set = ps, param_vals = param_vals, feature_types = c("numeric", "integer"), dict_entry = "scalemaxabs") } ), private = list( diff --git a/R/PipeOpScaleRange.R b/R/PipeOpScaleRange.R index f6b71f1eb..21250f6d1 100644 --- a/R/PipeOpScaleRange.R +++ b/R/PipeOpScaleRange.R @@ -67,7 +67,7 @@ PipeOpScaleRange = R6Class("PipeOpScaleRange", upper = p_dbl(tags = c("required", "train")) ) ps$values = list(lower = 0, upper = 1) - super$initialize(id, param_set = ps, param_vals = param_vals, feature_types = c("numeric", "integer")) + super$initialize(id, param_set = ps, param_vals = param_vals, feature_types = c("numeric", "integer"), dict_entry = "scalerange") } ), private = list( diff --git a/R/PipeOpSelect.R b/R/PipeOpSelect.R index 88492230a..4bd618791 100644 --- a/R/PipeOpSelect.R +++ b/R/PipeOpSelect.R @@ -74,7 +74,7 @@ PipeOpSelect = R6Class("PipeOpSelect", selector = p_uty(custom_check = check_function, tags = c("train", "required")) ) ps$values = list(selector = selector_all()) - super$initialize(id, ps, param_vals = param_vals, tags = "feature selection") + super$initialize(id, ps, param_vals = param_vals, tags = "feature selection", dict_entry = "select") } ), private = list( diff --git a/R/PipeOpSmote.R b/R/PipeOpSmote.R index cc73f9bfd..64b1d0e3d 100644 --- a/R/PipeOpSmote.R +++ b/R/PipeOpSmote.R @@ -80,7 +80,7 @@ PipeOpSmote = R6Class("PipeOpSmote", dup_size = p_int(lower = 1, default = 0, special_vals = list(0), tags = c("train", "smote")) ) super$initialize(id, param_set = ps, param_vals = param_vals, can_subset_cols = FALSE, - packages = "smotefamily", task_type = "TaskClassif", tags = "imbalanced data") + packages = "smotefamily", task_type = "TaskClassif", tags = "imbalanced data", dict_entry = "smote") } ), private = list( diff --git a/R/PipeOpSmoteNC.R b/R/PipeOpSmoteNC.R index aaaa458a6..9fc03b5ae 100644 --- a/R/PipeOpSmoteNC.R +++ b/R/PipeOpSmoteNC.R @@ -90,7 +90,7 @@ PipeOpSmoteNC = R6Class("PipeOpSmoteNC", over_ratio = p_dbl(lower = 0, default = 1, tags = c("train", "smotenc")) ) super$initialize(id, param_set = ps, param_vals = param_vals, packages = "themis", can_subset_cols = FALSE, - task_type = "TaskClassif", tags = "imbalanced data") + task_type = "TaskClassif", tags = "imbalanced data", dict_entry = "smotenc") } ), private = list( diff --git a/R/PipeOpSpatialSign.R b/R/PipeOpSpatialSign.R index f480b12f2..d82f0b81b 100644 --- a/R/PipeOpSpatialSign.R +++ b/R/PipeOpSpatialSign.R @@ -62,7 +62,7 @@ PipeOpSpatialSign = R6Class("PipeOpSpatialSign", norm = p_dbl(tags = c("train", "predict"), lower = 0) ) ps$values = list(norm = 2, length = 1) - super$initialize(id, param_set = ps, param_vals = param_vals, feature_types = c("numeric", "integer")) + super$initialize(id, param_set = ps, param_vals = param_vals, feature_types = c("numeric", "integer"), dict_entry = "spatialsign") } ), private = list( diff --git a/R/PipeOpSubsample.R b/R/PipeOpSubsample.R index 243f6a9d0..6d9efe55b 100644 --- a/R/PipeOpSubsample.R +++ b/R/PipeOpSubsample.R @@ -87,7 +87,7 @@ PipeOpSubsample = R6Class("PipeOpSubsample", replace = p_lgl(tags = "train") ) ps$values = list(frac = 1 - exp(-1), stratify = FALSE, use_groups = TRUE, replace = FALSE) - super$initialize(id, param_set = ps, param_vals = param_vals, can_subset_cols = FALSE) + super$initialize(id, param_set = ps, param_vals = param_vals, can_subset_cols = FALSE, dict_entry = "subsample") } ), private = list( diff --git a/R/PipeOpTaskPreproc.R b/R/PipeOpTaskPreproc.R index 8e6e0b584..e1107e324 100644 --- a/R/PipeOpTaskPreproc.R +++ b/R/PipeOpTaskPreproc.R @@ -168,7 +168,7 @@ PipeOpTaskPreproc = R6Class("PipeOpTaskPreproc", public = list( initialize = function(id, param_set = ps(), param_vals = list(), can_subset_cols = TRUE, - packages = character(0), task_type = "Task", tags = NULL, feature_types = mlr_reflections$task_feature_types) { + packages = character(0), task_type = "Task", tags = NULL, feature_types = mlr_reflections$task_feature_types, dict_entry = id) { if (can_subset_cols) { affectcols_ps = ps(affect_columns = p_uty(custom_check = check_function_or_null, default = selector_all(), tags = "train")) if (inherits(param_set, "ParamSet")) { @@ -182,7 +182,7 @@ PipeOpTaskPreproc = R6Class("PipeOpTaskPreproc", super$initialize(id = id, param_set = param_set, param_vals = param_vals, input = data.table(name = "input", train = task_type, predict = task_type), output = data.table(name = "output", train = task_type, predict = task_type), - packages = packages, tags = c(tags, "data transform") + packages = packages, tags = c(tags, "data transform"), dict_entry = dict_entry ) } ), diff --git a/R/PipeOpTextVectorizer.R b/R/PipeOpTextVectorizer.R index 8a750c2ba..52be32ded 100644 --- a/R/PipeOpTextVectorizer.R +++ b/R/PipeOpTextVectorizer.R @@ -215,7 +215,7 @@ PipeOpTextVectorizer = R6Class("PipeOpTextVectorizer", ) ps$values = list(stopwords_language = "smart", extra_stopwords = character(0), n = 1, scheme_df = "unary", return_type = "bow") - super$initialize(id = id, param_set = ps, param_vals = param_vals, packages = c("quanteda", "stopwords"), feature_types = "character") + super$initialize(id = id, param_set = ps, param_vals = param_vals, packages = c("quanteda", "stopwords"), feature_types = "character", dict_entry = "textvectorizer") } ), private = list( diff --git a/R/PipeOpThreshold.R b/R/PipeOpThreshold.R index 6a85f6f5b..ace65f4aa 100644 --- a/R/PipeOpThreshold.R +++ b/R/PipeOpThreshold.R @@ -67,7 +67,7 @@ PipeOpThreshold = R6Class("PipeOpThreshold", super$initialize(id, param_set = param_set, param_vals = param_vals, packages = character(0), input = data.table(name = "input", train = "NULL", predict = "PredictionClassif"), output = data.table(name = "output", train = "NULL", predict = "PredictionClassif"), - tags = "target transform") + tags = "target transform", dict_entry = "threshold") } ), active = list( diff --git a/R/PipeOpTomek.R b/R/PipeOpTomek.R index 974b5b668..5081bb505 100644 --- a/R/PipeOpTomek.R +++ b/R/PipeOpTomek.R @@ -69,7 +69,7 @@ PipeOpTomek = R6Class("PipeOpTomek", public = list( initialize = function(id = "tomek", param_vals = list()) { super$initialize(id, param_set = ps(), param_vals = param_vals, packages = "themis", can_subset_cols = FALSE, - task_type = "TaskClassif", tags = "imbalanced data") + task_type = "TaskClassif", tags = "imbalanced data", dict_entry = "tomek") } ), private = list( diff --git a/R/PipeOpTrafo.R b/R/PipeOpTrafo.R index 56bb0b511..8eed80919 100644 --- a/R/PipeOpTrafo.R +++ b/R/PipeOpTrafo.R @@ -116,11 +116,11 @@ PipeOpTargetTrafo = R6Class("PipeOpTargetTrafo", inherit = PipeOp, public = list( - initialize = function(id, param_set = ps(), param_vals = list(), packages = character(0), task_type_in = "Task", task_type_out = task_type_in, tags = NULL) { + initialize = function(id, param_set = ps(), param_vals = list(), packages = character(0), task_type_in = "Task", task_type_out = task_type_in, tags = NULL, dict_entry = id) { super$initialize(id = id, param_set = param_set, param_vals = param_vals, input = data.table(name = "input", train = task_type_in, predict = task_type_in), output = data.table(name = c("fun", "output"), train = c("NULL", task_type_out), predict = c("function", task_type_out)), - packages = packages, tags = c(tags, "target transform") + packages = packages, tags = c(tags, "target transform"), dict_entry = dict_entry ) } ), @@ -231,7 +231,7 @@ PipeOpTargetInvert = R6Class("PipeOpTargetInvert", initialize = function(id = "targetinvert", param_vals = list()) { super$initialize(id = id, param_vals = param_vals, input = data.table(name = c("fun", "prediction"), train = c("NULL", "NULL"), predict = c("function", "Prediction")), - output = data.table(name = "output", train = "NULL", predict = "Prediction"), tags = "target transform" + output = data.table(name = "output", train = "NULL", predict = "Prediction"), tags = "target transform", dict_entry = "targetinvert" ) } ), @@ -355,7 +355,7 @@ PipeOpTargetMutate = R6Class("PipeOpTargetMutate", # see https://github.com/mlr-org/paradox/issues/216 and related comment in PipeOpLearnerCV ps$values = list(trafo = identity, inverter = identity) - super$initialize(id = id, param_set = ps, param_vals = param_vals) + super$initialize(id = id, param_set = ps, param_vals = param_vals, dict_entry = "targetmutate") } ), active = list( @@ -466,7 +466,7 @@ PipeOpTargetTrafoScaleRange = R6Class("PipeOpTargetTrafoScaleRange", upper = p_dbl(tags = c("required", "train")) ) ps$values = list(lower = 0, upper = 1) - super$initialize(id = id, param_set = ps, param_vals = param_vals, task_type_in = "TaskRegr") + super$initialize(id = id, param_set = ps, param_vals = param_vals, task_type_in = "TaskRegr", dict_entry = "targettrafoscalerange") } ), private = list( diff --git a/R/PipeOpTuneThreshold.R b/R/PipeOpTuneThreshold.R index 2e0b50a42..78acbfbc6 100644 --- a/R/PipeOpTuneThreshold.R +++ b/R/PipeOpTuneThreshold.R @@ -95,7 +95,7 @@ PipeOpTuneThreshold = R6Class("PipeOpTuneThreshold", super$initialize(id, param_set = ps, param_vals = param_vals, packages = "bbotk", input = data.table(name = "input", train = "Task", predict = "Task"), output = data.table(name = "output", train = "NULL", predict = "Prediction"), - tags = "target transform" + tags = "target transform", dict_entry = "tunethreshold" ) } ), diff --git a/R/PipeOpUnbranch.R b/R/PipeOpUnbranch.R index 2df4726ef..d31d9b46c 100644 --- a/R/PipeOpUnbranch.R +++ b/R/PipeOpUnbranch.R @@ -79,7 +79,7 @@ PipeOpUnbranch = R6Class("PipeOpUnbranch", super$initialize(id, param_vals = param_vals, input = data.table(name = options, train = "*", predict = "*"), output = data.table(name = "output", train = "*", predict = "*"), - tags = "meta" + tags = "meta", dict_entry = "unbranch" ) } ), diff --git a/R/PipeOpVtreat.R b/R/PipeOpVtreat.R index 3e723c631..7d7e804d2 100644 --- a/R/PipeOpVtreat.R +++ b/R/PipeOpVtreat.R @@ -194,7 +194,7 @@ PipeOpVtreat = R6Class("PipeOpVtreat", # NOTE: parallelCluster missing intentionally and will be set to NULL ) ps$values = list(recommended = TRUE, cols_to_copy = selector_none()) - super$initialize(id, param_set = ps, param_vals = param_vals, packages = "vtreat", task_type = "TaskSupervised", tags = c("encode", "missings")) + super$initialize(id, param_set = ps, param_vals = param_vals, packages = "vtreat", task_type = "TaskSupervised", tags = c("encode", "missings"), dict_entry = "vtreat") } ), private = list( diff --git a/R/PipeOpYeoJohnson.R b/R/PipeOpYeoJohnson.R index 891c9cbc7..930044224 100644 --- a/R/PipeOpYeoJohnson.R +++ b/R/PipeOpYeoJohnson.R @@ -77,7 +77,7 @@ PipeOpYeoJohnson = R6Class("PipeOpYeoJohnson", upper = p_dbl(tags = c("train", "yj")) ) super$initialize(id, param_set = ps, param_vals = param_vals, - packages = "bestNormalize", feature_types = c("numeric", "integer")) + packages = "bestNormalize", feature_types = c("numeric", "integer"), dict_entry = "yeojohnson") } ), private = list( diff --git a/tests/testthat/test_GraphLearner.R b/tests/testthat/test_GraphLearner.R index c8ebe4e8f..1ad0e699d 100644 --- a/tests/testthat/test_GraphLearner.R +++ b/tests/testthat/test_GraphLearner.R @@ -9,7 +9,7 @@ test_that("basic graphlearner tests", { gr = PipeOpLearner$new(lrn) glrn = GraphLearner$new(gr) - glrn$properties = setdiff(glrn$properties, "weights") # FIXME: workaround until weights handling does not need to be part of the paramset + glrn$.__enclos_env__$private$.properties = setdiff(glrn$properties, "weights") # FIXME: workaround until weights handling does not need to be part of the paramset if ("use_weights" %in% names(glrn)) { # FIXME: condition can be removed when mlr3 weights update, mlr3-org/mlr3#1124 is on CRAN glrn$use_weights = "error" # also need to update use_weights now } @@ -42,12 +42,13 @@ test_that("basic graphlearner tests", { glrn2 = GraphLearner$new(gr2) glrn2_clone = glrn2$clone(deep = TRUE) expect_learner(glrn2) - glrn2$properties = setdiff(glrn2$properties, "weights") # FIXME: see above + properties_temp = glrn2$properties + glrn2$.__enclos_env__$private$.properties = setdiff(glrn2$properties, "weights") # FIXME: see above if ("use_weights" %in% names(glrn2)) { # FIXME: see above glrn2$use_weights = "error" # see above } expect_true(run_experiment(task, glrn2)$ok) - glrn2$properties = c(glrn2$properties, "weights") # reset changes + glrn2$.__enclos_env__$private$.properties = properties_temp # reset changes if ("use_weights" %in% names(glrn2)) { # FIXME: see above glrn2$use_weights = "use" # reset changes } @@ -55,6 +56,7 @@ test_that("basic graphlearner tests", { glrn2_clone$state = glrn2$state # glrn2_clone$state$log = glrn2_clone$state$log$clone(deep = TRUE) # FIXME: this can go when mlr-org/mlr3#343 is fixed # glrn2_clone$state$model$classif.rpart$log = glrn2_clone$state$model$classif.rpart$log$clone(deep = TRUE) # FIXME: this can go when mlr-org/mlr3#343 is fixed + glrn2_clone$label ; glrn2$label # trigger private$.label cache expect_deep_clone(glrn2_clone, glrn2$clone(deep = TRUE)) expect_prediction_classif({ graphpred2 = glrn2$predict(task) @@ -180,9 +182,11 @@ test_that("graphlearner parameters behave as they should", { dblrn$param_set$values$warning_train = 1 dblrn$param_set$values$warning_predict = 1 - pol = PipeOpLearner$new(dblrn, param_vals = list(message_predict = 0, warning_train = 0, warning_predict = 0)) + pol = PipeOpLearner$new(dblrn) + pol$param_set$set_values(.values = list(message_predict = 0, warning_train = 0, warning_predict = 0)) - gl = GraphLearner$new(pol, param_vals = list(classif.debug.warning_train = 1, classif.debug.warning_predict = 1)) + gl = GraphLearner$new(pol) + gl$param_set$set_values(.values = list(classif.debug.warning_train = 1, classif.debug.warning_predict = 1)) gl$param_set$values$classif.debug.warning_predict = 0 @@ -511,6 +515,8 @@ test_that("GraphLearner model", { lr = GraphLearner$new(graph) + lr$param_set ; graph$param_set # trigger .param_set cache + expect_equal(lr$graph, graph) expect_equal(lr$graph_model, graph) @@ -518,6 +524,8 @@ test_that("GraphLearner model", { lr$train(tsk("iris")) + graph$param_set ; graph_orig$param_set # trigger .param_set cache + expect_equal(graph, graph_orig) expect_null(graph$state$pca) @@ -535,7 +543,6 @@ test_that("GraphLearner model", { expect_equal(lr$graph_model$pipeops$classif.rpart$learner_model$importance(), imp) - }) test_that("predict() function for Graph", { @@ -822,7 +829,7 @@ test_that("base_learner() works", { # double-channel pipeop cascade: see there is no exponential explosion gchain = chain_graphs( - lapply(1:20, function(i) ppl("branch", pos(paste0("nop_", c(2 * i, 2 * i + 1))), prefix_branchops = as.character(i))), + lapply(1:20, function(i) ppl("branch", pos(paste0("nop_", c(2 * i, 2 * i + 1))), prefix_branchops = sprintf("x%02d", i))), in_place = TRUE ) From 2c05976c524a365df999006bc46f8b0c89f230fe Mon Sep 17 00:00:00 2001 From: mb706 Date: Thu, 14 Aug 2025 15:51:02 +0200 Subject: [PATCH 10/31] tests progress --- tests/testthat/test_Graph.R | 4 ++-- tests/testthat/test_dictionary.R | 9 ++++++--- tests/testthat/test_pipeop_ensemble.R | 4 ++-- tests/testthat/test_pipeop_learnerpicvplus.R | 5 +++-- tests/testthat/test_pipeop_targetmutate.R | 14 +++++++------- tests/testthat/test_pipeop_task_preproc.R | 2 +- 6 files changed, 21 insertions(+), 17 deletions(-) diff --git a/tests/testthat/test_Graph.R b/tests/testthat/test_Graph.R index 82006abdb..97d8f88b6 100644 --- a/tests/testthat/test_Graph.R +++ b/tests/testthat/test_Graph.R @@ -61,9 +61,9 @@ test_that("complex graph", { biggraph = PipeOpDebugBasic$new() %>>% PipeOpDebugMulti$new(1, 2) %>>% pipeline_greplicate(PipeOpDebugMulti$new(1, 2, "debug2"), 2) %>>% - gunion(list(PipeOpDebugBasic$new("basictop"), + gunion(list(PipeOpDebugBasic$new(id = "basictop"), PipeOpDebugMulti$new(2, 1, "debug2"), - PipeOpDebugBasic$new("basicbottom"))) %>>% + PipeOpDebugBasic$new(id = "basicbottom"))) %>>% PipeOpDebugMulti$new(3, 1, "debug3") lines = strsplit(capture_output(biggraph$train(1)), "\n")[[1]] diff --git a/tests/testthat/test_dictionary.R b/tests/testthat/test_dictionary.R index bdba692c9..9937ed95b 100644 --- a/tests/testthat/test_dictionary.R +++ b/tests/testthat/test_dictionary.R @@ -114,6 +114,7 @@ test_that("Dictionary contains all PipeOps", { expect_false(isTRUE(all.equal(other_obj$phash, test_obj$phash)), info = paste(dictname, "$new id test")) test_obj$id = "TESTID" other_obj = inflate(do.call(mlr_pipeops$get, c(list(dictname), args))) + all.equal(other_obj, other_obj$clone(deep = TRUE)) # realize all cache items expect_equal(other_obj, test_obj, info = paste(dictname, "$new id test 2")) if (!dictname %in% pval_unhashable) { expect_equal(other_obj$hash, test_obj$hash, info = paste(dictname, "$new id test 2")) @@ -150,13 +151,15 @@ test_that("Dictionary contains all PipeOps", { val = setdiff(candidates, origval)[1] # construct the `param_vals = list(PARNAME = PARVAL)` construction argument - args$param_vals = list(val) - names(args$param_vals) = testingparam + parvals = list(val) + names(parvals) = testingparam # check that the constructed object is different from the test_obj, but setting the test_obj's parameter # makes them equal again. dict_constructed = do.call(mlr_pipeops$get, c(list(dictname), args)) + dict_constructed$param_set$set_values(.values = parvals) gen_constructed = do.call(pogen$new, args) + gen_constructed$param_set$set_values(.values = parvals) expect_false(isTRUE(all.equal(dict_constructed, test_obj)), dictname) expect_false(isTRUE(all.equal(dict_constructed$hash, test_obj$hash)), dictname) # phash should be independent of this! @@ -172,7 +175,7 @@ test_that("Dictionary contains all PipeOps", { # $label can be retrieved expect_string(test_obj$label) - help_metainfo = paste(capture.output(print(str(test_obj$help()))), sep = "\n") + help_metainfo = paste(capture.output(print(str(test_obj$help()))), collapse = "\n") expect_false(grepl("^LABEL COULD NOT BE RETRIEVED$", test_obj$label), info = paste(dictname, help_metainfo, sep = "\n")) if (identical(help, utils::help)) { # different behaviour if pkgload / devtools are doing help vs. vanilla R help() diff --git a/tests/testthat/test_pipeop_ensemble.R b/tests/testthat/test_pipeop_ensemble.R index 4a514b009..d65adff86 100644 --- a/tests/testthat/test_pipeop_ensemble.R +++ b/tests/testthat/test_pipeop_ensemble.R @@ -12,11 +12,11 @@ test_that("PipeOpEnsemble - basic properties", { expect_list(train_pipeop(op, rep(list(NULL), 4)), len = 1) expect_error(predict_pipeop(op, prds), "Abstract") - op = PipeOpEnsemble$new(0, id = "ensemble", param_vals = list()) + op = PipeOpEnsemble$new(0, id = "ensemble") expect_pipeop(op) # collect_multiplicity = TRUE - op = PipeOpEnsemble$new(0, collect_multiplicity = TRUE, id = "ensemble", param_vals = list()) + op = PipeOpEnsemble$new(0, collect_multiplicity = TRUE, id = "ensemble") expect_pipeop(op) expect_list(train_pipeop(op, list(as.Multiplicity(rep(list(NULL), 4)))), len = 1) expect_error(predict_pipeop(op, list(as.Multiplicity(prds))), "Abstract") diff --git a/tests/testthat/test_pipeop_learnerpicvplus.R b/tests/testthat/test_pipeop_learnerpicvplus.R index 53a12891f..e57fda58a 100644 --- a/tests/testthat/test_pipeop_learnerpicvplus.R +++ b/tests/testthat/test_pipeop_learnerpicvplus.R @@ -63,8 +63,9 @@ test_that("PipeOpLearnerPICVPlus - param set and values", { po$param_set$values$picvplus.folds = 5 expect_equal(po$param_set$values, list(picvplus.folds = 5, picvplus.alpha = 0.05, minsplit = 2, xval = 0)) - expect_error(PipeOpLearnerPICVPlus$new(lrn, param_vals = list(picvplus.folds = 1)), "is not >= 1") - expect_error(PipeOpLearnerPICVPlus$new(lrn, param_vals = list(picvplus.alpha = -1)), "is not >= -") + po1 = PipeOpLearnerPICVPlus$new(lrn) + expect_error(po1$param_set$set_values(.values = list(picvplus.folds = 1)), "is not >= 1") + expect_error(po1$param_set$set_values(.values = list(picvplus.alpha = -1)), "is not >= -") lrn_classif = mlr_learners$get("classif.featureless") expect_error(PipeOpLearnerPICVPlus$new(lrn_classif), "only supports regression") diff --git a/tests/testthat/test_pipeop_targetmutate.R b/tests/testthat/test_pipeop_targetmutate.R index b727b751a..0fcba1a21 100644 --- a/tests/testthat/test_pipeop_targetmutate.R +++ b/tests/testthat/test_pipeop_targetmutate.R @@ -2,9 +2,9 @@ context("PipeOpTargetMutate") test_that("PipeOpTargetMutate - basic properties", { skip_if_not_installed("rpart") - expect_pipeop_class(PipeOpTargetMutate, list(id = "po")) + expect_pipeop_class(PipeOpTargetMutate, list()) - po = PipeOpTargetMutate$new("po") + po = PipeOpTargetMutate$new() expect_pipeop(po) @@ -41,12 +41,12 @@ test_that("PipeOpTargetMutate - basic properties", { test_that("PipeOpTargetMutate - log base 2 trafo", { skip_if_not_installed("rpart") g = Graph$new() - g$add_pipeop(PipeOpTargetMutate$new("logtrafo", - param_vals = list( - trafo = function(x) log(x, base = 2), - inverter = function(x) list(response = 2 ^ x$response)) - ) + g$add_pipeop(PipeOpTargetMutate$new()$configure( + id = "logtrafo", + trafo = function(x) log(x, base = 2), + inverter = function(x) list(response = 2 ^ x$response)) ) + g$add_pipeop(LearnerRegrRpart$new()) g$add_pipeop(po("targetinvert")) g$add_edge(src_id = "logtrafo", dst_id = "targetinvert", src_channel = 1L, dst_channel = 1L) diff --git a/tests/testthat/test_pipeop_task_preproc.R b/tests/testthat/test_pipeop_task_preproc.R index dc2cf1df6..875585714 100644 --- a/tests/testthat/test_pipeop_task_preproc.R +++ b/tests/testthat/test_pipeop_task_preproc.R @@ -3,7 +3,7 @@ context("PipeOpTaskPreproc") test_that("PipeOpTaskPreproc - basic properties", { expect_pipeop_class(PipeOpTaskPreproc, list(id = "potask")) - po = PipeOpTaskPreproc$new("potask") + po = PipeOpTaskPreproc$new(id = "potask") expect_pipeop(po) expect_data_table(po$input, nrows = 1) From a91b2f5ab8775797ca66e92998e9c4636c3623cb Mon Sep 17 00:00:00 2001 From: mb706 Date: Thu, 14 Aug 2025 22:33:32 +0200 Subject: [PATCH 11/31] essentially trial and error --- tests/testthat/test_dictionary.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/testthat/test_dictionary.R b/tests/testthat/test_dictionary.R index 9937ed95b..a5040ba5c 100644 --- a/tests/testthat/test_dictionary.R +++ b/tests/testthat/test_dictionary.R @@ -11,6 +11,7 @@ test_that("Dictionary contains all PipeOps", { inflate = function(x) { x$label x$param_set$values$content$label + lapply(x$.__enclos_env__$private, function(x) if (inherits(x, "Mlr3Component")) inflate(x)) x } @@ -114,7 +115,7 @@ test_that("Dictionary contains all PipeOps", { expect_false(isTRUE(all.equal(other_obj$phash, test_obj$phash)), info = paste(dictname, "$new id test")) test_obj$id = "TESTID" other_obj = inflate(do.call(mlr_pipeops$get, c(list(dictname), args))) - all.equal(other_obj, other_obj$clone(deep = TRUE)) # realize all cache items + expect_equal(other_obj, test_obj, info = paste(dictname, "$new id test 2")) if (!dictname %in% pval_unhashable) { expect_equal(other_obj$hash, test_obj$hash, info = paste(dictname, "$new id test 2")) From d468df0ec6365dff3933896e2803c5b04382c4aa Mon Sep 17 00:00:00 2001 From: mb706 Date: Thu, 14 Aug 2025 22:46:52 +0200 Subject: [PATCH 12/31] try again --- tests/testthat/test_dictionary.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test_dictionary.R b/tests/testthat/test_dictionary.R index a5040ba5c..baf6d0252 100644 --- a/tests/testthat/test_dictionary.R +++ b/tests/testthat/test_dictionary.R @@ -11,7 +11,7 @@ test_that("Dictionary contains all PipeOps", { inflate = function(x) { x$label x$param_set$values$content$label - lapply(x$.__enclos_env__$private, function(x) if (inherits(x, "Mlr3Component")) inflate(x)) + lapply(as.list(x$.__enclos_env__$private, all.names = TRUE), function(x) if (inherits(x, "Mlr3Component")) inflate(x)) x } From cd8b9cffae20c3f7cb56ecf597ca782fabf31ba2 Mon Sep 17 00:00:00 2001 From: mb706 Date: Thu, 14 Aug 2025 23:07:18 +0200 Subject: [PATCH 13/31] adjusting docs --- R/GraphLearner.R | 1 + R/PipeOp.R | 1 + R/PipeOpColRoles.R | 3 +-- R/PipeOpDateFeatures.R | 3 +-- R/PipeOpEncodeImpact.R | 3 +-- R/PipeOpEncodeLmer.R | 3 +-- R/PipeOpEncodePL.R | 5 +++-- R/PipeOpEnsemble.R | 1 + R/PipeOpFeatureUnion.R | 4 ++-- R/PipeOpImpute.R | 5 +++-- R/PipeOpImputeConstant.R | 3 +-- R/PipeOpLearnerPICVPlus.R | 3 +-- R/PipeOpMultiplicity.R | 9 +++------ R/PipeOpNMF.R | 3 +-- R/PipeOpProxy.R | 3 +-- R/PipeOpRandomResponse.R | 4 ++-- R/PipeOpTaskPreproc.R | 10 ++++++---- R/PipeOpThreshold.R | 1 - R/PipeOpTrafo.R | 9 +++++---- R/PipeOpTuneThreshold.R | 3 +-- man/mlr_pipeops_colapply.Rd | 2 +- man/mlr_pipeops_encodepltree.Rd | 8 ++++---- man/mlr_pipeops_learner_quantiles.Rd | 2 +- man/mlr_pipeops_tunethreshold.Rd | 2 +- man/set_validate.GraphLearner.Rd | 4 ++-- 25 files changed, 45 insertions(+), 50 deletions(-) diff --git a/R/GraphLearner.R b/R/GraphLearner.R index c0a488b68..2bf9702a4 100644 --- a/R/GraphLearner.R +++ b/R/GraphLearner.R @@ -31,6 +31,7 @@ #' Identifier of the resulting [`Learner`][mlr3::Learner]. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings . Default `list()`. +#' Deprecated, will be removed in the future. #' * `task_type` :: `character(1)`\cr #' What `task_type` the `GraphLearner` should have; usually automatically inferred for [`Graph`]s that are simple enough. #' * `predict_type` :: `character(1)`\cr diff --git a/R/PipeOp.R b/R/PipeOp.R index 6995df6de..f8911e52b 100644 --- a/R/PipeOp.R +++ b/R/PipeOp.R @@ -50,6 +50,7 @@ #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings given in `param_set`. The #' subclass should have its own `param_vals` parameter and pass it on to `super$initialize()`. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' * `input` :: [`data.table`][data.table::data.table] with columns `name` (`character`), `train` (`character`), `predict` (`character`)\cr #' Sets the `$input` slot of the resulting object; see description there. #' * `output` :: [`data.table`][data.table::data.table] with columns `name` (`character`), `train` (`character`), `predict` (`character`)\cr diff --git a/R/PipeOpColRoles.R b/R/PipeOpColRoles.R index 26f5d78f3..11eff469b 100644 --- a/R/PipeOpColRoles.R +++ b/R/PipeOpColRoles.R @@ -17,8 +17,7 @@ #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"colroles"`. #' * `param_vals` :: named `list`\cr -#' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise -#' be set during construction. Default `list()`. +#' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. diff --git a/R/PipeOpDateFeatures.R b/R/PipeOpDateFeatures.R index cd286aca8..bcb67b064 100644 --- a/R/PipeOpDateFeatures.R +++ b/R/PipeOpDateFeatures.R @@ -29,8 +29,7 @@ #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"datefeatures"`. #' * `param_vals` :: named `list`\cr -#' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise -#' be set during construction. Default `list()`. +#' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. diff --git a/R/PipeOpEncodeImpact.R b/R/PipeOpEncodeImpact.R index eac433a0f..3bf96163d 100644 --- a/R/PipeOpEncodeImpact.R +++ b/R/PipeOpEncodeImpact.R @@ -24,8 +24,7 @@ #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"encodeimpact"`. #' * `param_vals` :: named `list`\cr -#' List of hyperparameter settings, overwriting the hyperparameter settings that would -#' otherwise be set during construction. Default `list()`. +#' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. Instead of a [`Task`][mlr3::Task], a diff --git a/R/PipeOpEncodeLmer.R b/R/PipeOpEncodeLmer.R index eaf624571..1c4344e42 100644 --- a/R/PipeOpEncodeLmer.R +++ b/R/PipeOpEncodeLmer.R @@ -38,8 +38,7 @@ #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"encodelmer"`. #' * `param_vals` :: named `list`\cr -#' List of hyperparameter settings, overwriting the hyperparameter settings that would -#' otherwise be set during construction. Default `list()`. +#' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. Instead of a [`Task`][mlr3::Task], a diff --git a/R/PipeOpEncodePL.R b/R/PipeOpEncodePL.R index b5d75faf5..88d1cbd47 100644 --- a/R/PipeOpEncodePL.R +++ b/R/PipeOpEncodePL.R @@ -26,8 +26,9 @@ #' * `param_set` :: [`ParamSet`][paradox::ParamSet]\cr #' Parameter space description. This should be created by the subclass and given to `super$initialize()`. #' * `param_vals` :: named `list`\cr -#' List of hyperparameter settings, overwriting the hyperparameter settings given in `param_set`. The -#' subclass should have its own `param_vals` parameter and pass it on to `super$initialize()`. Default `list()`. +#' List of hyperparameter settings, overwriting the hyperparameter settings given in `param_set`. +#' The subclass should have its own `param_vals` parameter and pass it on to `super$initialize()`. Default `list()`. +#' Deprecated, will be removed in the future. #' * `packages` :: `character`\cr #' Set of all required packages for the [`PipeOp`]'s `private$.train()` and `private$.predict()` methods. See `$packages` slot. #' Default is `character(0)`. diff --git a/R/PipeOpEnsemble.R b/R/PipeOpEnsemble.R index 7227e959c..9b6e0816c 100644 --- a/R/PipeOpEnsemble.R +++ b/R/PipeOpEnsemble.R @@ -26,6 +26,7 @@ #' ("Hyper"-)Parameters in form of a [`ParamSet`][paradox::ParamSet] for the resulting [`PipeOp`]. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. #' * `packages` :: `character`\cr #' Set of packages required for this `PipeOp`. These packages are loaded during `$train()` and `$predict()`, but not attached. #' Default `character(0)`. diff --git a/R/PipeOpFeatureUnion.R b/R/PipeOpFeatureUnion.R index 70d919a2e..fe5a12841 100644 --- a/R/PipeOpFeatureUnion.R +++ b/R/PipeOpFeatureUnion.R @@ -38,8 +38,8 @@ #' * `id` :: `character(1)`\cr #' Identifier of the resulting object, default `"featureunion"`. #' * `param_vals` :: named `list`\cr -#' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise -#' be set during construction. Default `list()`. +#' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' * `assert_targets_equal` :: `logical(1)`\cr #' If `assert_targets_equal` is `TRUE` (Default), task target column names are checked for #' agreement. Disagreeing target column names are usually a bug, so this should often be left at diff --git a/R/PipeOpImpute.R b/R/PipeOpImpute.R index 59e440bc0..ef86c2bfb 100644 --- a/R/PipeOpImpute.R +++ b/R/PipeOpImpute.R @@ -17,8 +17,9 @@ #' * `param_set` :: [`ParamSet`][paradox::ParamSet]\cr #' Parameter space description. This should be created by the subclass and given to `super$initialize()`. #' * `param_vals` :: named `list`\cr -#' List of hyperparameter settings, overwriting the hyperparameter settings given in `param_set`. The -#' subclass should have its own `param_vals` parameter and pass it on to `super$initialize()`. Default `list()`. +#' List of hyperparameter settings, overwriting the hyperparameter settings given in `param_set`. +#' The subclass should have its own `param_vals` parameter and pass it on to `super$initialize()`. Default `list()`. +#' Deprecated, will be removed in the future. #' * `whole_task_dependent` :: `logical(1)`\cr #' Whether the `context_columns` parameter should be added which lets the user limit the columns that are #' used for imputation inference. This should generally be `FALSE` if imputation depends only on individual features diff --git a/R/PipeOpImputeConstant.R b/R/PipeOpImputeConstant.R index 2c49efa53..cbf5ad7ad 100644 --- a/R/PipeOpImputeConstant.R +++ b/R/PipeOpImputeConstant.R @@ -15,8 +15,7 @@ #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"imputeconstant"`. #' * `param_vals` :: named `list`\cr -#' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise -#' be set during construction. Default `list()`. +#' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpImpute`]. diff --git a/R/PipeOpLearnerPICVPlus.R b/R/PipeOpLearnerPICVPlus.R index 764833e01..2b82a1e9d 100644 --- a/R/PipeOpLearnerPICVPlus.R +++ b/R/PipeOpLearnerPICVPlus.R @@ -26,8 +26,7 @@ #' * `id` :: `character(1)` #' Identifier of the resulting object, internally defaulting to the `id` of the [`Learner`][mlr3::Learner] being wrapped. #' * `param_vals` :: named `list`\cr -#' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. -#' Default is `list()`. +#' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default is `list()`. #' #' @section Input and Output Channels: #' `PipeOpLearnerPICVPlus` has one input channel named `"input"`, taking a [`Task`][mlr3::Task] specific to the [`Learner`][mlr3::Learner] diff --git a/R/PipeOpMultiplicity.R b/R/PipeOpMultiplicity.R index 3ef5c39e7..51014d997 100644 --- a/R/PipeOpMultiplicity.R +++ b/R/PipeOpMultiplicity.R @@ -27,8 +27,7 @@ #' * `id` :: `character(1)`\cr #' Identifier of the resulting object, default `"multiplicityimply"`. #' * `param_vals` :: named `list`\cr -#' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise -#' be set during construction. Default `list()`. +#' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' #' @section Input and Output Channels: #' [`PipeOpMultiplicityImply`] has multiple input channels depending on the `innum` construction @@ -135,8 +134,7 @@ mlr_pipeops$add("multiplicityimply", PipeOpMultiplicityImply) #' * `id` :: `character(1)`\cr #' Identifier of the resulting object, default `"multiplicityexply"`. #' * `param_vals` :: named `list`\cr -#' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise -#' be set during construction. Default `list()`. +#' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' #' @section Input and Output Channels: #' [`PipeOpMultiplicityExply`] has a single input channel named `"input"`, collecting a @@ -222,8 +220,7 @@ mlr_pipeops$add("multiplicityexply", PipeOpMultiplicityExply, list("N")) #' * `id` :: `character(1)` #' Identifier of the resulting object, default `"replicate"`. #' * `param_vals` :: named `list`\cr -#' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise -#' be set during construction. Default `list()`. +#' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' #' @section Input and Output Channels: #' [`PipeOpReplicate`] has one input channel named `"input"`, taking any input (`"*"`) both during training and prediction. diff --git a/R/PipeOpNMF.R b/R/PipeOpNMF.R index b9825901f..cf08086ac 100644 --- a/R/PipeOpNMF.R +++ b/R/PipeOpNMF.R @@ -16,8 +16,7 @@ #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"nmf"`. #' * `param_vals` :: named `list`\cr -#' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise -#' be set during construction. Default `list()`. +#' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. diff --git a/R/PipeOpProxy.R b/R/PipeOpProxy.R index 01a04aa9b..498ed71cd 100644 --- a/R/PipeOpProxy.R +++ b/R/PipeOpProxy.R @@ -22,8 +22,7 @@ #' * `id` :: `character(1)`\cr #' Identifier of resulting object. See `$id` slot of [`PipeOp`]. #' * `param_vals` :: named `list`\cr -#' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise -#' be set during construction. Default `list()`. +#' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' #' @section Input and Output Channels: #' `PipeOpProxy` has multiple input channels depending on the `innum` construction argument, named diff --git a/R/PipeOpRandomResponse.R b/R/PipeOpRandomResponse.R index 4a968f4fc..b32e339ae 100644 --- a/R/PipeOpRandomResponse.R +++ b/R/PipeOpRandomResponse.R @@ -25,8 +25,8 @@ #' * `id` :: `character(1)`\cr #' Identifier of the resulting object, default `"randomresponse"`. #' * `param_vals` :: named `list`\cr -#' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise -#' be set during construction. Default `list()`. +#' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' * packages :: `character`\cr #' Set of all required packages for the `private$.predict()` methods related to the `rdistfun` #' parameter. Default is `character(0)`. diff --git a/R/PipeOpTaskPreproc.R b/R/PipeOpTaskPreproc.R index e1107e324..426a283f6 100644 --- a/R/PipeOpTaskPreproc.R +++ b/R/PipeOpTaskPreproc.R @@ -44,8 +44,9 @@ #' * `param_set` :: [`ParamSet`][paradox::ParamSet]\cr #' Parameter space description. This should be created by the subclass and given to `super$initialize()`. #' * `param_vals` :: named `list`\cr -#' List of hyperparameter settings, overwriting the hyperparameter settings given in `param_set`. The -#' subclass should have its own `param_vals` parameter and pass it on to `super$initialize()`. Default `list()`. +#' List of hyperparameter settings, overwriting the hyperparameter settings given in `param_set`. +#' The subclass should have its own `param_vals` parameter and pass it on to `super$initialize()`. Default `list()`. +#' Deprecated, will be removed in the future. #' * `can_subset_cols` :: `logical(1)`\cr #' Whether the `affect_columns` parameter should be added which lets the user limit the columns that are #' modified by the `PipeOpTaskPreproc`. This should generally be `FALSE` if the operation adds or removes @@ -330,8 +331,9 @@ PipeOpTaskPreproc = R6Class("PipeOpTaskPreproc", #' * `param_set` :: [`ParamSet`][paradox::ParamSet]\cr #' Parameter space description. This should be created by the subclass and given to `super$initialize()`. #' * `param_vals` :: named `list`\cr -#' List of hyperparameter settings, overwriting the hyperparameter settings given in `param_set`. The -#' subclass should have its own `param_vals` parameter and pass it on to `super$initialize()`. Default `list()`. +#' List of hyperparameter settings, overwriting the hyperparameter settings given in `param_set`. +#' The subclass should have its own `param_vals` parameter and pass it on to `super$initialize()`. Default `list()`. +#' Deprecated, will be removed in the future. #' * `can_subset_cols` :: `logical(1)`\cr #' Whether the `affect_columns` parameter should be added which lets the user limit the columns that are #' modified by the `PipeOpTaskPreprocSimple`. This should generally be `FALSE` if the operation adds or removes diff --git a/R/PipeOpThreshold.R b/R/PipeOpThreshold.R index ace65f4aa..5a2f4e955 100644 --- a/R/PipeOpThreshold.R +++ b/R/PipeOpThreshold.R @@ -18,7 +18,6 @@ #' Identifier of the resulting object, default `"threshold"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. -#' Defaults to `numeric(0)`. #' #' @section Input and Output Channels: #' During training, the input and output are `NULL`. diff --git a/R/PipeOpTrafo.R b/R/PipeOpTrafo.R index 8eed80919..069532133 100644 --- a/R/PipeOpTrafo.R +++ b/R/PipeOpTrafo.R @@ -26,6 +26,7 @@ #' List of hyperparameter settings, overwriting the hyperparameter settings given in `param_set`. #' The subclass should have its own `param_vals` parameter and pass it on to `super$initialize()`. #' Default `list()`. +#' Deprecated, will be removed in the future. #' * `task_type_in` :: `character(1)`\cr #' The class of [`Task`][mlr3::Task] that should be accepted as input. This should generally be a `character(1)` #' identifying a type of [`Task`][mlr3::Task], e.g. `"Task"`, `"TaskClassif"` or `"TaskRegr"` (or another subclass @@ -267,8 +268,8 @@ mlr_pipeops$add("targetinvert", PipeOpTargetInvert) #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"targetmutate"`. #' * `param_vals` :: named `list`\cr -#' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise -#' be set during construction. Default `list()`. +#' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' * `new_task_type` :: `character(1)` | `NULL`\cr #' The task type to which the output is converted, must be one of `mlr_reflections$task_types$type`. #' Defaults to `NULL`: no change in task type. @@ -413,8 +414,7 @@ mlr_pipeops$add("targetmutate", PipeOpTargetMutate) #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"targettrafoscalerange"`. #' * `param_vals` :: named `list`\cr -#' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise -#' be set during construction. Default `list()`. +#' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTargetTrafo`]. @@ -529,6 +529,7 @@ mlr_pipeops$add("targettrafoscalerange", PipeOpTargetTrafoScaleRange) #' List of hyperparameter settings, overwriting the hyperparameter settings given in `param_set`. #' The subclass should have its own `param_vals` parameter and pass it on to `super$initialize()`. #' Default `list()`. +#' Deprecated, will be removed in the future. #' #' @section Parameters: #' The parameters are the parameters inherited from [`PipeOpTargetTrafo`], as well as: diff --git a/R/PipeOpTuneThreshold.R b/R/PipeOpTuneThreshold.R index 78acbfbc6..09a761bf1 100644 --- a/R/PipeOpTuneThreshold.R +++ b/R/PipeOpTuneThreshold.R @@ -26,8 +26,7 @@ #' * `id` :: `character(1)`\cr #' Identifier of resulting object. Default: "tunethreshold". #' * `param_vals` :: named `list`\cr -#' List of hyperparameter settings, overwriting the hyperparameter settings -#' that would otherwise be set during construction. Default `list()`. +#' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOp`]. diff --git a/man/mlr_pipeops_colapply.Rd b/man/mlr_pipeops_colapply.Rd index 11b1280c4..41b07ff74 100644 --- a/man/mlr_pipeops_colapply.Rd +++ b/man/mlr_pipeops_colapply.Rd @@ -62,7 +62,7 @@ Use \code{\link[base:Vectorize]{Vectorize}} to create a vectorizing function fro \section{Internals}{ -Calls \code{\link[mlr3misc:compat-map]{map}} on the data, using the value of \code{applicator} as \code{f.} and coerces the output via \code{\link{as.data.table}}. +Calls \code{\link[mlr3misc:map]{map}} on the data, using the value of \code{applicator} as \code{f.} and coerces the output via \code{\link{as.data.table}}. } \section{Fields}{ diff --git a/man/mlr_pipeops_encodepltree.Rd b/man/mlr_pipeops_encodepltree.Rd index 2053eb2b5..4013473cd 100644 --- a/man/mlr_pipeops_encodepltree.Rd +++ b/man/mlr_pipeops_encodepltree.Rd @@ -23,8 +23,8 @@ column into account, and using decision boundaries as bin boundaries. \item \code{task_type} :: \code{character(1)}\cr The class of \code{\link[mlr3:Task]{Task}} that should be accepted as input, given as a \code{character(1)}. This is used to construct the appropriate \code{\link[mlr3:Learner]{Learner}} to be used for obtaining the bins for piecewise linear -encoding. Supported options are \code{"TaskClassif"}for \code{\link[mlr3:mlr_learners_classif.rpart]{LearnerClassifRpart}} or -\code{"TaskRegr"}for \code{\link[mlr3:mlr_learners_regr.rpart]{LearnerRegrRpart}}. +encoding. Supported options are \code{"TaskClassif"}for \code{\link[mlr3:LearnerClassifRpart]{LearnerClassifRpart}} or +\code{"TaskRegr"}for \code{\link[mlr3:LearnerRegrRpart]{LearnerRegrRpart}}. \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"encodeplquantiles"}. \item \code{param_vals} :: named \code{list}\cr @@ -57,8 +57,8 @@ the \code{\link[mlr3:Learner]{Learner}} used for obtaining the bins for piecewis This overloads the \code{private$.get_bins()} method of \code{\link{PipeOpEncodePL}}. To derive the bins for each feature, the \code{\link[mlr3:Task]{Task}} is split into smaller \code{\link[mlr3:Task]{Tasks}} with only the target and respective feature as columns. -On these \code{\link[mlr3:Task]{Tasks}} either a \code{\link[mlr3:mlr_learners_classif.rpart]{LearnerClassifRpart}} or -\code{\link[mlr3:mlr_learners_regr.rpart]{LearnerRegrRpart}} gets trained and the respective splits extracted as bin boundaries used +On these \code{\link[mlr3:Task]{Tasks}} either a \code{\link[mlr3:LearnerClassifRpart]{LearnerClassifRpart}} or +\code{\link[mlr3:LearnerRegrRpart]{LearnerRegrRpart}} gets trained and the respective splits extracted as bin boundaries used for piecewise linear encodings. } diff --git a/man/mlr_pipeops_learner_quantiles.Rd b/man/mlr_pipeops_learner_quantiles.Rd index 9acf72b50..88244f271 100644 --- a/man/mlr_pipeops_learner_quantiles.Rd +++ b/man/mlr_pipeops_learner_quantiles.Rd @@ -3,7 +3,7 @@ \name{mlr_pipeops_learner_quantiles} \alias{mlr_pipeops_learner_quantiles} \alias{PipeOpLearnerQuantiles} -\title{Wrap a Learner into a PipeOp to to predict multiple Quantiles} +\title{Wrap a Learner into a PipeOp to predict multiple Quantiles} \format{ \code{\link[R6:R6Class]{R6Class}} object inheriting from \code{\link{PipeOp}}. } diff --git a/man/mlr_pipeops_tunethreshold.Rd b/man/mlr_pipeops_tunethreshold.Rd index f2707ef05..a8f935e3a 100644 --- a/man/mlr_pipeops_tunethreshold.Rd +++ b/man/mlr_pipeops_tunethreshold.Rd @@ -19,7 +19,7 @@ Returns a single \code{\link[mlr3:PredictionClassif]{PredictionClassif}}. This PipeOp should be used in conjunction with \code{\link{PipeOpLearnerCV}} in order to optimize thresholds of cross-validated predictions. In order to optimize thresholds without cross-validation, use \code{\link{PipeOpLearnerCV}} -in conjunction with \code{\link[mlr3:mlr_resamplings_insample]{ResamplingInsample}}. +in conjunction with \code{\link[mlr3:ResamplingInsample]{ResamplingInsample}}. } \section{Construction}{ diff --git a/man/set_validate.GraphLearner.Rd b/man/set_validate.GraphLearner.Rd index 9d87b5866..95ef2a2b8 100644 --- a/man/set_validate.GraphLearner.Rd +++ b/man/set_validate.GraphLearner.Rd @@ -27,12 +27,12 @@ This parameter is ignored when \code{validate} is set to \code{NULL}. By default, validation is enabled for the final \code{PipeOp} in the \code{Graph}.} \item{args_all}{(\code{list()})\cr -Rarely needed. A named list of parameter values that are passed to all subsequet \code{\link[mlr3:mlr_sugar]{set_validate()}} calls on the individual +Rarely needed. A named list of parameter values that are passed to all subsequet \code{\link[mlr3:set_validate]{set_validate()}} calls on the individual \code{PipeOp}s.} \item{args}{(named \code{list()})\cr Rarely needed. -A named list of lists, specifying additional argments to be passed to \code{\link[mlr3:mlr_sugar]{set_validate()}} when calling it on the individual +A named list of lists, specifying additional argments to be passed to \code{\link[mlr3:set_validate]{set_validate()}} when calling it on the individual \code{PipeOp}s.} \item{...}{(any)\cr From 42bedd8e6ec951b2f7f0e1b3c3204470ba0702cd Mon Sep 17 00:00:00 2001 From: mb706 Date: Thu, 14 Aug 2025 23:08:49 +0200 Subject: [PATCH 14/31] deprecation message --- R/PipeOpADAS.R | 1 + R/PipeOpBLSmote.R | 1 + R/PipeOpBoxCox.R | 1 + R/PipeOpBranch.R | 1 + R/PipeOpChunk.R | 1 + R/PipeOpClassBalancing.R | 1 + R/PipeOpClassWeights.R | 1 + R/PipeOpClassifAvg.R | 1 + R/PipeOpColApply.R | 1 + R/PipeOpColRoles.R | 1 + R/PipeOpCollapseFactors.R | 1 + R/PipeOpCopy.R | 1 + R/PipeOpDateFeatures.R | 1 + R/PipeOpDecode.R | 1 + R/PipeOpEncode.R | 1 + R/PipeOpEncodeImpact.R | 1 + R/PipeOpEncodeLmer.R | 1 + R/PipeOpEncodePL.R | 2 ++ R/PipeOpFilter.R | 1 + R/PipeOpFixFactors.R | 1 + R/PipeOpHistBin.R | 1 + R/PipeOpICA.R | 1 + R/PipeOpImputeConstant.R | 1 + R/PipeOpImputeHist.R | 1 + R/PipeOpImputeLearner.R | 1 + R/PipeOpImputeMean.R | 1 + R/PipeOpImputeMedian.R | 1 + R/PipeOpImputeMode.R | 1 + R/PipeOpImputeOOR.R | 1 + R/PipeOpImputeSample.R | 1 + R/PipeOpKernelPCA.R | 1 + R/PipeOpLearner.R | 1 + R/PipeOpLearnerCV.R | 1 + R/PipeOpLearnerPICVPlus.R | 1 + R/PipeOpLearnerQuantiles.R | 1 + R/PipeOpMissingIndicators.R | 1 + R/PipeOpModelMatrix.R | 1 + R/PipeOpMultiplicity.R | 3 +++ R/PipeOpMutate.R | 1 + R/PipeOpNMF.R | 1 + R/PipeOpNOP.R | 1 + R/PipeOpNearmiss.R | 1 + R/PipeOpOVR.R | 2 ++ R/PipeOpPCA.R | 1 + R/PipeOpProxy.R | 1 + R/PipeOpQuantileBin.R | 1 + R/PipeOpRegrAvg.R | 1 + R/PipeOpRemoveConstants.R | 1 + R/PipeOpRenameColumns.R | 1 + R/PipeOpRowApply.R | 1 + R/PipeOpScale.R | 1 + R/PipeOpScaleMaxAbs.R | 1 + R/PipeOpScaleRange.R | 1 + R/PipeOpSelect.R | 1 + R/PipeOpSmote.R | 1 + R/PipeOpSmoteNC.R | 1 + R/PipeOpSpatialSign.R | 1 + R/PipeOpSubsample.R | 1 + R/PipeOpTextVectorizer.R | 1 + R/PipeOpThreshold.R | 1 + R/PipeOpTomek.R | 1 + R/PipeOpTrafo.R | 2 ++ R/PipeOpTuneThreshold.R | 1 + R/PipeOpUnbranch.R | 1 + R/PipeOpVtreat.R | 1 + R/PipeOpYeoJohnson.R | 1 + 66 files changed, 71 insertions(+) diff --git a/R/PipeOpADAS.R b/R/PipeOpADAS.R index 6c7c098e4..a9106a3dc 100644 --- a/R/PipeOpADAS.R +++ b/R/PipeOpADAS.R @@ -21,6 +21,7 @@ #' Identifier of resulting object, default `"adas"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. Instead of a [`Task`][mlr3::Task], a diff --git a/R/PipeOpBLSmote.R b/R/PipeOpBLSmote.R index 67b6fa1d5..b630288fe 100644 --- a/R/PipeOpBLSmote.R +++ b/R/PipeOpBLSmote.R @@ -18,6 +18,7 @@ #' Identifier of resulting object, default `"smote"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. Instead of a [`Task`][mlr3::Task], a diff --git a/R/PipeOpBoxCox.R b/R/PipeOpBoxCox.R index 3e188b69c..4a84d7b1a 100644 --- a/R/PipeOpBoxCox.R +++ b/R/PipeOpBoxCox.R @@ -19,6 +19,7 @@ #' Identifier of resulting object, default `"boxcox"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. diff --git a/R/PipeOpBranch.R b/R/PipeOpBranch.R index a9ab77c9a..a0af09934 100644 --- a/R/PipeOpBranch.R +++ b/R/PipeOpBranch.R @@ -27,6 +27,7 @@ #' Identifier of resulting object, default `"branch"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' `PipeOpBranch` has one input channel named `"input"`, taking any input (`"*"`) both during training and prediction. diff --git a/R/PipeOpChunk.R b/R/PipeOpChunk.R index 64882777d..c67ebfc34 100644 --- a/R/PipeOpChunk.R +++ b/R/PipeOpChunk.R @@ -20,6 +20,7 @@ #' Identifier of resulting object, default `"chunk"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output: #' `PipeOpChunk` has one input channel named `"input"`, taking a [`Task`][mlr3::Task] both during training and prediction. diff --git a/R/PipeOpClassBalancing.R b/R/PipeOpClassBalancing.R index 9e469bb2d..377a55e71 100644 --- a/R/PipeOpClassBalancing.R +++ b/R/PipeOpClassBalancing.R @@ -20,6 +20,7 @@ #' Identifier of the resulting object, default `"classbalancing"` #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. Instead of a [`Task`][mlr3::Task], a diff --git a/R/PipeOpClassWeights.R b/R/PipeOpClassWeights.R index b1d9a7f41..8ab140f95 100644 --- a/R/PipeOpClassWeights.R +++ b/R/PipeOpClassWeights.R @@ -25,6 +25,7 @@ #' Identifier of the resulting object, default `"classweights"` #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. Instead of a [`Task`][mlr3::Task], a diff --git a/R/PipeOpClassifAvg.R b/R/PipeOpClassifAvg.R index fe77a1799..25de7f3f1 100644 --- a/R/PipeOpClassifAvg.R +++ b/R/PipeOpClassifAvg.R @@ -36,6 +36,7 @@ #' Identifier of the resulting object, default `"classifavg"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpEnsemble`]. Instead of a [`Prediction`][mlr3::Prediction], a [`PredictionClassif`][mlr3::PredictionClassif] diff --git a/R/PipeOpColApply.R b/R/PipeOpColApply.R index 20445cc6e..769a87722 100644 --- a/R/PipeOpColApply.R +++ b/R/PipeOpColApply.R @@ -24,6 +24,7 @@ #' Identifier of resulting object, default `"colapply"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. diff --git a/R/PipeOpColRoles.R b/R/PipeOpColRoles.R index 11eff469b..5e5ec2d9e 100644 --- a/R/PipeOpColRoles.R +++ b/R/PipeOpColRoles.R @@ -18,6 +18,7 @@ #' Identifier of resulting object, default `"colroles"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. diff --git a/R/PipeOpCollapseFactors.R b/R/PipeOpCollapseFactors.R index 7b794e26b..d3703cfbc 100644 --- a/R/PipeOpCollapseFactors.R +++ b/R/PipeOpCollapseFactors.R @@ -24,6 +24,7 @@ #' Identifier of resulting object, default `"collapsefactors"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. diff --git a/R/PipeOpCopy.R b/R/PipeOpCopy.R index 92b14ce59..8d30a0600 100644 --- a/R/PipeOpCopy.R +++ b/R/PipeOpCopy.R @@ -20,6 +20,7 @@ #' Identifier of resulting object, default `"copy"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' `PipeOpCopy` has one input channel named `"input"`, taking any input (`"*"`) both during training and prediction. diff --git a/R/PipeOpDateFeatures.R b/R/PipeOpDateFeatures.R index bcb67b064..bcb1f3f63 100644 --- a/R/PipeOpDateFeatures.R +++ b/R/PipeOpDateFeatures.R @@ -30,6 +30,7 @@ #' Identifier of resulting object, default `"datefeatures"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. diff --git a/R/PipeOpDecode.R b/R/PipeOpDecode.R index 5e72f245c..018aed4a5 100644 --- a/R/PipeOpDecode.R +++ b/R/PipeOpDecode.R @@ -22,6 +22,7 @@ #' Identifier of resulting object, default `"decode"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. diff --git a/R/PipeOpEncode.R b/R/PipeOpEncode.R index 753c399f3..c3fd0d5e0 100644 --- a/R/PipeOpEncode.R +++ b/R/PipeOpEncode.R @@ -25,6 +25,7 @@ #' Identifier of resulting object, default `"encode"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. diff --git a/R/PipeOpEncodeImpact.R b/R/PipeOpEncodeImpact.R index 3bf96163d..8b342c59a 100644 --- a/R/PipeOpEncodeImpact.R +++ b/R/PipeOpEncodeImpact.R @@ -25,6 +25,7 @@ #' Identifier of resulting object, default `"encodeimpact"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. Instead of a [`Task`][mlr3::Task], a diff --git a/R/PipeOpEncodeLmer.R b/R/PipeOpEncodeLmer.R index 1c4344e42..8a915dd76 100644 --- a/R/PipeOpEncodeLmer.R +++ b/R/PipeOpEncodeLmer.R @@ -39,6 +39,7 @@ #' Identifier of resulting object, default `"encodelmer"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. Instead of a [`Task`][mlr3::Task], a diff --git a/R/PipeOpEncodePL.R b/R/PipeOpEncodePL.R index 88d1cbd47..de339043d 100644 --- a/R/PipeOpEncodePL.R +++ b/R/PipeOpEncodePL.R @@ -160,6 +160,7 @@ encode_piecewise_linear = function(column, bins) { #' Identifier of resulting object, default `"encodeplquantiles"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. @@ -274,6 +275,7 @@ mlr_pipeops$add("encodeplquantiles", PipeOpEncodePLQuantiles) #' Identifier of resulting object, default `"encodeplquantiles"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. Instead of a [`Task`][mlr3::Task], a diff --git a/R/PipeOpFilter.R b/R/PipeOpFilter.R index 0f3381903..cd2252161 100644 --- a/R/PipeOpFilter.R +++ b/R/PipeOpFilter.R @@ -24,6 +24,7 @@ #' Identifier of the resulting object, defaulting to the `id` of the [`Filter`][mlr3filters::Filter] being used. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. diff --git a/R/PipeOpFixFactors.R b/R/PipeOpFixFactors.R index ca8a78e95..8f495de5e 100644 --- a/R/PipeOpFixFactors.R +++ b/R/PipeOpFixFactors.R @@ -20,6 +20,7 @@ #' Identifier of resulting object, default `"fixfactors"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. diff --git a/R/PipeOpHistBin.R b/R/PipeOpHistBin.R index 358463b55..a20da1fab 100644 --- a/R/PipeOpHistBin.R +++ b/R/PipeOpHistBin.R @@ -19,6 +19,7 @@ #' Identifier of resulting object, default `"histbin"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. diff --git a/R/PipeOpICA.R b/R/PipeOpICA.R index bc356b964..1fb2b9d07 100644 --- a/R/PipeOpICA.R +++ b/R/PipeOpICA.R @@ -17,6 +17,7 @@ #' Identifier of resulting object, default `"ica"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. diff --git a/R/PipeOpImputeConstant.R b/R/PipeOpImputeConstant.R index cbf5ad7ad..81457c4e5 100644 --- a/R/PipeOpImputeConstant.R +++ b/R/PipeOpImputeConstant.R @@ -16,6 +16,7 @@ #' Identifier of resulting object, default `"imputeconstant"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpImpute`]. diff --git a/R/PipeOpImputeHist.R b/R/PipeOpImputeHist.R index 3433dd599..63ba1eb17 100644 --- a/R/PipeOpImputeHist.R +++ b/R/PipeOpImputeHist.R @@ -23,6 +23,7 @@ #' Identifier of resulting object, default `"imputehist"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpImpute`]. diff --git a/R/PipeOpImputeLearner.R b/R/PipeOpImputeLearner.R index 647f217d2..bb69d3e8d 100644 --- a/R/PipeOpImputeLearner.R +++ b/R/PipeOpImputeLearner.R @@ -31,6 +31,7 @@ #' This argument is always cloned; to access the [`Learner`][mlr3::Learner] inside `PipeOpImputeLearner` by-reference, use `$learner`.\cr #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpImpute`]. diff --git a/R/PipeOpImputeMean.R b/R/PipeOpImputeMean.R index f8a4a7d8f..71bf6b9ff 100644 --- a/R/PipeOpImputeMean.R +++ b/R/PipeOpImputeMean.R @@ -16,6 +16,7 @@ #' Identifier of resulting object, default `"imputemean"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpImpute`]. diff --git a/R/PipeOpImputeMedian.R b/R/PipeOpImputeMedian.R index c3147353b..9d37f8387 100644 --- a/R/PipeOpImputeMedian.R +++ b/R/PipeOpImputeMedian.R @@ -16,6 +16,7 @@ #' Identifier of resulting object, default `"imputemedian"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpImpute`]. diff --git a/R/PipeOpImputeMode.R b/R/PipeOpImputeMode.R index cd0a8f09e..563698dab 100644 --- a/R/PipeOpImputeMode.R +++ b/R/PipeOpImputeMode.R @@ -17,6 +17,7 @@ #' Identifier of resulting object, default `"imputemode"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpImpute`]. diff --git a/R/PipeOpImputeOOR.R b/R/PipeOpImputeOOR.R index 376216d38..e9e70ffb6 100644 --- a/R/PipeOpImputeOOR.R +++ b/R/PipeOpImputeOOR.R @@ -40,6 +40,7 @@ #' Identifier of resulting object, default `"imputeoor"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpImpute`]. diff --git a/R/PipeOpImputeSample.R b/R/PipeOpImputeSample.R index 7c10c6612..523fd291b 100644 --- a/R/PipeOpImputeSample.R +++ b/R/PipeOpImputeSample.R @@ -16,6 +16,7 @@ #' Identifier of resulting object, default `"imputesample"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpImpute`]. diff --git a/R/PipeOpKernelPCA.R b/R/PipeOpKernelPCA.R index 86347e357..da87ae52c 100644 --- a/R/PipeOpKernelPCA.R +++ b/R/PipeOpKernelPCA.R @@ -17,6 +17,7 @@ #' Identifier of resulting object, default `"kernelpca"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. diff --git a/R/PipeOpLearner.R b/R/PipeOpLearner.R index 81165678a..f0555793a 100644 --- a/R/PipeOpLearner.R +++ b/R/PipeOpLearner.R @@ -26,6 +26,7 @@ #' Identifier of the resulting object, internally defaulting to the `id` of the [`Learner`][mlr3::Learner] being wrapped. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' `PipeOpLearner` has one input channel named `"input"`, taking a [`Task`][mlr3::Task] specific to the [`Learner`][mlr3::Learner] diff --git a/R/PipeOpLearnerCV.R b/R/PipeOpLearnerCV.R index dcc4b0693..947a6854b 100644 --- a/R/PipeOpLearnerCV.R +++ b/R/PipeOpLearnerCV.R @@ -35,6 +35,7 @@ #' Identifier of the resulting object, internally defaulting to the `id` of the [`Learner`][mlr3::Learner] being wrapped. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' `PipeOpLearnerCV` has one input channel named `"input"`, taking a [`Task`][mlr3::Task] specific to the [`Learner`][mlr3::Learner] diff --git a/R/PipeOpLearnerPICVPlus.R b/R/PipeOpLearnerPICVPlus.R index 2b82a1e9d..5a1217767 100644 --- a/R/PipeOpLearnerPICVPlus.R +++ b/R/PipeOpLearnerPICVPlus.R @@ -27,6 +27,7 @@ #' Identifier of the resulting object, internally defaulting to the `id` of the [`Learner`][mlr3::Learner] being wrapped. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default is `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' `PipeOpLearnerPICVPlus` has one input channel named `"input"`, taking a [`Task`][mlr3::Task] specific to the [`Learner`][mlr3::Learner] diff --git a/R/PipeOpLearnerQuantiles.R b/R/PipeOpLearnerQuantiles.R index 9706e53cf..498862c85 100644 --- a/R/PipeOpLearnerQuantiles.R +++ b/R/PipeOpLearnerQuantiles.R @@ -26,6 +26,7 @@ #' Identifier of the resulting object, internally defaulting to the `id` of the [`Learner`][mlr3::Learner] being wrapped. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' `PipeOpLearnerQuantiles` has one input channel named `"input"`, taking a [`TaskRegr`][mlr3::TaskRegr] specific to the [`Learner`][mlr3::Learner] diff --git a/R/PipeOpMissingIndicators.R b/R/PipeOpMissingIndicators.R index 1f0a898fb..c33bb22ba 100644 --- a/R/PipeOpMissingIndicators.R +++ b/R/PipeOpMissingIndicators.R @@ -20,6 +20,7 @@ #' Identifier of the resulting object, defaulting to `"missind"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section State: #' `$state` is a named `list` with the `$state` elements inherited from [`PipeOpTaskPreproc`], as well as: diff --git a/R/PipeOpModelMatrix.R b/R/PipeOpModelMatrix.R index d825e2c3f..8c4645d6a 100644 --- a/R/PipeOpModelMatrix.R +++ b/R/PipeOpModelMatrix.R @@ -16,6 +16,7 @@ #' Identifier of resulting object, default `"modelmatrix"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. diff --git a/R/PipeOpMultiplicity.R b/R/PipeOpMultiplicity.R index 51014d997..22834e816 100644 --- a/R/PipeOpMultiplicity.R +++ b/R/PipeOpMultiplicity.R @@ -28,6 +28,7 @@ #' Identifier of the resulting object, default `"multiplicityimply"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' [`PipeOpMultiplicityImply`] has multiple input channels depending on the `innum` construction @@ -135,6 +136,7 @@ mlr_pipeops$add("multiplicityimply", PipeOpMultiplicityImply) #' Identifier of the resulting object, default `"multiplicityexply"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' [`PipeOpMultiplicityExply`] has a single input channel named `"input"`, collecting a @@ -221,6 +223,7 @@ mlr_pipeops$add("multiplicityexply", PipeOpMultiplicityExply, list("N")) #' Identifier of the resulting object, default `"replicate"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' [`PipeOpReplicate`] has one input channel named `"input"`, taking any input (`"*"`) both during training and prediction. diff --git a/R/PipeOpMutate.R b/R/PipeOpMutate.R index 7878f2112..85eb022fe 100644 --- a/R/PipeOpMutate.R +++ b/R/PipeOpMutate.R @@ -16,6 +16,7 @@ #' Identifier of resulting object, default `"mutate"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. diff --git a/R/PipeOpNMF.R b/R/PipeOpNMF.R index cf08086ac..44b96bb15 100644 --- a/R/PipeOpNMF.R +++ b/R/PipeOpNMF.R @@ -17,6 +17,7 @@ #' Identifier of resulting object, default `"nmf"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. diff --git a/R/PipeOpNOP.R b/R/PipeOpNOP.R index 2a0fa610c..1f9901004 100644 --- a/R/PipeOpNOP.R +++ b/R/PipeOpNOP.R @@ -16,6 +16,7 @@ #' Identifier of resulting object, default `"nop"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' `PipeOpNOP` has one input channel named `"input"`, taking any input (`"*"`) both during training and prediction. diff --git a/R/PipeOpNearmiss.R b/R/PipeOpNearmiss.R index cf4f6e852..2d5342b0d 100644 --- a/R/PipeOpNearmiss.R +++ b/R/PipeOpNearmiss.R @@ -23,6 +23,7 @@ #' Identifier of resulting object, default `"nearmiss"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. Instead of a [`Task`][mlr3::Task], a diff --git a/R/PipeOpOVR.R b/R/PipeOpOVR.R index 40e9d5a4b..39ceb8c35 100644 --- a/R/PipeOpOVR.R +++ b/R/PipeOpOVR.R @@ -28,6 +28,7 @@ #' Identifier of the resulting object, default `"ovrsplit"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' [`PipeOpOVRSplit`] has one input channel named `"input"` taking a [`TaskClassif`][mlr3::TaskClassif] @@ -144,6 +145,7 @@ mlr_pipeops$add("ovrsplit", PipeOpOVRSplit) #' Identifier of the resulting object, default `"ovrunite"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpEnsemble`]. Instead of a diff --git a/R/PipeOpPCA.R b/R/PipeOpPCA.R index e0068dc5b..697ed5fd5 100644 --- a/R/PipeOpPCA.R +++ b/R/PipeOpPCA.R @@ -17,6 +17,7 @@ #' Identifier of resulting object, default `"pca"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. diff --git a/R/PipeOpProxy.R b/R/PipeOpProxy.R index 498ed71cd..eed3dedc8 100644 --- a/R/PipeOpProxy.R +++ b/R/PipeOpProxy.R @@ -23,6 +23,7 @@ #' Identifier of resulting object. See `$id` slot of [`PipeOp`]. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' `PipeOpProxy` has multiple input channels depending on the `innum` construction argument, named diff --git a/R/PipeOpQuantileBin.R b/R/PipeOpQuantileBin.R index 81bd485a1..8cad0649e 100644 --- a/R/PipeOpQuantileBin.R +++ b/R/PipeOpQuantileBin.R @@ -16,6 +16,7 @@ #' Identifier of resulting object, default `"quantilebin"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. diff --git a/R/PipeOpRegrAvg.R b/R/PipeOpRegrAvg.R index f068cda7a..680dfee96 100644 --- a/R/PipeOpRegrAvg.R +++ b/R/PipeOpRegrAvg.R @@ -31,6 +31,7 @@ #' Identifier of the resulting object, default `"regravg"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpEnsemble`]. Instead of a [`Prediction`][mlr3::Prediction], a [`PredictionRegr`][mlr3::PredictionRegr] diff --git a/R/PipeOpRemoveConstants.R b/R/PipeOpRemoveConstants.R index eac33e320..3c329df2a 100644 --- a/R/PipeOpRemoveConstants.R +++ b/R/PipeOpRemoveConstants.R @@ -19,6 +19,7 @@ #' Identifier of the resulting object, defaulting to `"removeconstants"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section State: #' `$state` is a named `list` with the `$state` elements inherited from [`PipeOpTaskPreproc`], as well as: diff --git a/R/PipeOpRenameColumns.R b/R/PipeOpRenameColumns.R index f3c8c3748..aab4bc7d8 100644 --- a/R/PipeOpRenameColumns.R +++ b/R/PipeOpRenameColumns.R @@ -17,6 +17,7 @@ #' Identifier of resulting object, default `"renamecolumns"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. diff --git a/R/PipeOpRowApply.R b/R/PipeOpRowApply.R index 7951de30b..76346f117 100644 --- a/R/PipeOpRowApply.R +++ b/R/PipeOpRowApply.R @@ -17,6 +17,7 @@ #' Identifier of resulting object, default `"rowapply"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. diff --git a/R/PipeOpScale.R b/R/PipeOpScale.R index 82ba1c6cf..585638585 100644 --- a/R/PipeOpScale.R +++ b/R/PipeOpScale.R @@ -20,6 +20,7 @@ #' Identifier of resulting object, default `"scale"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. diff --git a/R/PipeOpScaleMaxAbs.R b/R/PipeOpScaleMaxAbs.R index 770ea4b56..88809c91c 100644 --- a/R/PipeOpScaleMaxAbs.R +++ b/R/PipeOpScaleMaxAbs.R @@ -18,6 +18,7 @@ #' Identifier of resulting object, default `"scalemaxabs"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. diff --git a/R/PipeOpScaleRange.R b/R/PipeOpScaleRange.R index 21250f6d1..4582976f0 100644 --- a/R/PipeOpScaleRange.R +++ b/R/PipeOpScaleRange.R @@ -20,6 +20,7 @@ #' Identifier of resulting object, default `"scalerange"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. diff --git a/R/PipeOpSelect.R b/R/PipeOpSelect.R index 4bd618791..feabf3554 100644 --- a/R/PipeOpSelect.R +++ b/R/PipeOpSelect.R @@ -17,6 +17,7 @@ #' Identifier of resulting object, default `"select"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. diff --git a/R/PipeOpSmote.R b/R/PipeOpSmote.R index 64b1d0e3d..faa17c675 100644 --- a/R/PipeOpSmote.R +++ b/R/PipeOpSmote.R @@ -18,6 +18,7 @@ #' Identifier of resulting object, default `"smote"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. Instead of a [`Task`][mlr3::Task], a diff --git a/R/PipeOpSmoteNC.R b/R/PipeOpSmoteNC.R index 9fc03b5ae..13c259b2d 100644 --- a/R/PipeOpSmoteNC.R +++ b/R/PipeOpSmoteNC.R @@ -29,6 +29,7 @@ #' Identifier of resulting object, default `"smotenc"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. Instead of a [`Task`][mlr3::Task], a diff --git a/R/PipeOpSpatialSign.R b/R/PipeOpSpatialSign.R index d82f0b81b..67be253be 100644 --- a/R/PipeOpSpatialSign.R +++ b/R/PipeOpSpatialSign.R @@ -16,6 +16,7 @@ #' Identifier of resulting object, default `"spatialsign"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. diff --git a/R/PipeOpSubsample.R b/R/PipeOpSubsample.R index 6d9efe55b..6dd9e1031 100644 --- a/R/PipeOpSubsample.R +++ b/R/PipeOpSubsample.R @@ -19,6 +19,7 @@ #' Identifier of the resulting object, default `"subsample"` #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. diff --git a/R/PipeOpTextVectorizer.R b/R/PipeOpTextVectorizer.R index 52be32ded..2dda099b6 100644 --- a/R/PipeOpTextVectorizer.R +++ b/R/PipeOpTextVectorizer.R @@ -43,6 +43,7 @@ #' Identifier of resulting object, default `"textvectorizer"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. diff --git a/R/PipeOpThreshold.R b/R/PipeOpThreshold.R index 5a2f4e955..88f81ed26 100644 --- a/R/PipeOpThreshold.R +++ b/R/PipeOpThreshold.R @@ -18,6 +18,7 @@ #' Identifier of the resulting object, default `"threshold"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' During training, the input and output are `NULL`. diff --git a/R/PipeOpTomek.R b/R/PipeOpTomek.R index 5081bb505..600a07ee7 100644 --- a/R/PipeOpTomek.R +++ b/R/PipeOpTomek.R @@ -24,6 +24,7 @@ #' Identifier of resulting object, default `"tomek"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. Instead of a [`Task`][mlr3::Task], a diff --git a/R/PipeOpTrafo.R b/R/PipeOpTrafo.R index 069532133..05360602d 100644 --- a/R/PipeOpTrafo.R +++ b/R/PipeOpTrafo.R @@ -198,6 +198,7 @@ PipeOpTargetTrafo = R6Class("PipeOpTargetTrafo", #' Identifier of resulting object, default `"targetinvert"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' `PipeOpTargetInvert` has two input channels named `"fun"` and `"prediction"`. During @@ -415,6 +416,7 @@ mlr_pipeops$add("targetmutate", PipeOpTargetMutate) #' Identifier of resulting object, default `"targettrafoscalerange"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTargetTrafo`]. diff --git a/R/PipeOpTuneThreshold.R b/R/PipeOpTuneThreshold.R index 09a761bf1..57b9b9ad0 100644 --- a/R/PipeOpTuneThreshold.R +++ b/R/PipeOpTuneThreshold.R @@ -27,6 +27,7 @@ #' Identifier of resulting object. Default: "tunethreshold". #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOp`]. diff --git a/R/PipeOpUnbranch.R b/R/PipeOpUnbranch.R index d31d9b46c..fdd2117a3 100644 --- a/R/PipeOpUnbranch.R +++ b/R/PipeOpUnbranch.R @@ -26,6 +26,7 @@ #' Identifier of resulting object, default `"unbranch"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output: #' `PipeOpUnbranch` has multiple input channels depending on the `options` construction argument, named `"input1"`, `"input2"`, ... diff --git a/R/PipeOpVtreat.R b/R/PipeOpVtreat.R index 7d7e804d2..45b52c7f5 100644 --- a/R/PipeOpVtreat.R +++ b/R/PipeOpVtreat.R @@ -21,6 +21,7 @@ #' Identifier of resulting object, default `"vtreat"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. Instead of a [`Task`][mlr3::Task], a diff --git a/R/PipeOpYeoJohnson.R b/R/PipeOpYeoJohnson.R index 930044224..9f3062c90 100644 --- a/R/PipeOpYeoJohnson.R +++ b/R/PipeOpYeoJohnson.R @@ -18,6 +18,7 @@ #' Identifier of resulting object, default `"yeojohnson"`. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. #' #' @section Input and Output Channels: #' Input and output channels are inherited from [`PipeOpTaskPreproc`]. From d2e27de04151babd3ca0b4a44ec873fa71b4dc40 Mon Sep 17 00:00:00 2001 From: mb706 Date: Thu, 14 Aug 2025 23:24:19 +0200 Subject: [PATCH 15/31] deprecation message II --- R/PipeOp.R | 1 + R/PipeOpADAS.R | 1 + R/PipeOpBLSmote.R | 1 + R/PipeOpBoxCox.R | 1 + R/PipeOpBranch.R | 1 + R/PipeOpChunk.R | 1 + R/PipeOpClassBalancing.R | 1 + R/PipeOpClassWeights.R | 1 + R/PipeOpClassifAvg.R | 1 + R/PipeOpColApply.R | 1 + R/PipeOpColRoles.R | 1 + R/PipeOpCollapseFactors.R | 1 + R/PipeOpCopy.R | 1 + R/PipeOpDateFeatures.R | 1 + R/PipeOpDecode.R | 1 + R/PipeOpEncode.R | 1 + R/PipeOpEncodeImpact.R | 1 + R/PipeOpEncodeLmer.R | 1 + R/PipeOpEncodePL.R | 2 ++ R/PipeOpEnsemble.R | 1 + R/PipeOpFeatureUnion.R | 1 + R/PipeOpFilter.R | 1 + R/PipeOpFixFactors.R | 1 + R/PipeOpHistBin.R | 1 + R/PipeOpICA.R | 1 + R/PipeOpImpute.R | 1 + R/PipeOpImputeConstant.R | 1 + R/PipeOpImputeHist.R | 1 + R/PipeOpImputeLearner.R | 1 + R/PipeOpImputeMean.R | 1 + R/PipeOpImputeMedian.R | 1 + R/PipeOpImputeMode.R | 1 + R/PipeOpImputeOOR.R | 1 + R/PipeOpImputeSample.R | 1 + R/PipeOpKernelPCA.R | 1 + R/PipeOpLearner.R | 1 + R/PipeOpLearnerCV.R | 1 + R/PipeOpLearnerPICVPlus.R | 1 + R/PipeOpLearnerQuantiles.R | 1 + R/PipeOpMissingIndicators.R | 1 + R/PipeOpModelMatrix.R | 1 + R/PipeOpMultiplicity.R | 3 +++ R/PipeOpMutate.R | 1 + R/PipeOpNMF.R | 1 + R/PipeOpNOP.R | 1 + R/PipeOpNearmiss.R | 1 + R/PipeOpOVR.R | 2 ++ R/PipeOpPCA.R | 1 + R/PipeOpProxy.R | 1 + R/PipeOpQuantileBin.R | 1 + R/PipeOpRandomProjection.R | 1 + R/PipeOpRandomResponse.R | 1 + R/PipeOpRegrAvg.R | 1 + R/PipeOpRemoveConstants.R | 1 + R/PipeOpRenameColumns.R | 1 + R/PipeOpRowApply.R | 1 + R/PipeOpScale.R | 1 + R/PipeOpScaleMaxAbs.R | 1 + R/PipeOpScaleRange.R | 1 + R/PipeOpSelect.R | 1 + R/PipeOpSmote.R | 1 + R/PipeOpSmoteNC.R | 1 + R/PipeOpSpatialSign.R | 1 + R/PipeOpSubsample.R | 1 + R/PipeOpTaskPreproc.R | 1 + R/PipeOpTextVectorizer.R | 1 + R/PipeOpThreshold.R | 1 + R/PipeOpTomek.R | 1 + R/PipeOpTrafo.R | 3 +++ R/PipeOpTuneThreshold.R | 1 + R/PipeOpUnbranch.R | 1 + R/PipeOpVtreat.R | 1 + R/PipeOpYeoJohnson.R | 1 + 73 files changed, 79 insertions(+) diff --git a/R/PipeOp.R b/R/PipeOp.R index f8911e52b..52a003495 100644 --- a/R/PipeOp.R +++ b/R/PipeOp.R @@ -42,6 +42,7 @@ #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object. See `$id` slot. +#' Deprecated, will be removed in the future. #' * `param_set` :: [`ParamSet`][paradox::ParamSet] | `list` of `expression`\cr #' Parameter space description. This should be created by the subclass and given to `super$initialize()`. #' If this is a [`ParamSet`][paradox::ParamSet], it is used as the `PipeOp`'s [`ParamSet`][paradox::ParamSet] diff --git a/R/PipeOpADAS.R b/R/PipeOpADAS.R index a9106a3dc..414df03eb 100644 --- a/R/PipeOpADAS.R +++ b/R/PipeOpADAS.R @@ -19,6 +19,7 @@ #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"adas"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpBLSmote.R b/R/PipeOpBLSmote.R index b630288fe..966254a71 100644 --- a/R/PipeOpBLSmote.R +++ b/R/PipeOpBLSmote.R @@ -16,6 +16,7 @@ #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"smote"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpBoxCox.R b/R/PipeOpBoxCox.R index 4a84d7b1a..61b5cd812 100644 --- a/R/PipeOpBoxCox.R +++ b/R/PipeOpBoxCox.R @@ -17,6 +17,7 @@ #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"boxcox"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpBranch.R b/R/PipeOpBranch.R index a0af09934..35af239e4 100644 --- a/R/PipeOpBranch.R +++ b/R/PipeOpBranch.R @@ -25,6 +25,7 @@ #' The `$selection` parameter will then be factorial. #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"branch"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpChunk.R b/R/PipeOpChunk.R index c67ebfc34..0dcc5f16f 100644 --- a/R/PipeOpChunk.R +++ b/R/PipeOpChunk.R @@ -18,6 +18,7 @@ #' Number of output channels, and therefore number of chunks created. #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"chunk"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpClassBalancing.R b/R/PipeOpClassBalancing.R index 377a55e71..e6b970fe8 100644 --- a/R/PipeOpClassBalancing.R +++ b/R/PipeOpClassBalancing.R @@ -18,6 +18,7 @@ #' #' * `id` :: `character(1)` #' Identifier of the resulting object, default `"classbalancing"` +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpClassWeights.R b/R/PipeOpClassWeights.R index 8ab140f95..dcbf0a694 100644 --- a/R/PipeOpClassWeights.R +++ b/R/PipeOpClassWeights.R @@ -23,6 +23,7 @@ #' #' * `id` :: `character(1)` #' Identifier of the resulting object, default `"classweights"` +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpClassifAvg.R b/R/PipeOpClassifAvg.R index 25de7f3f1..34b250735 100644 --- a/R/PipeOpClassifAvg.R +++ b/R/PipeOpClassifAvg.R @@ -34,6 +34,7 @@ #' Default is `FALSE`. #' * `id` :: `character(1)` #' Identifier of the resulting object, default `"classifavg"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpColApply.R b/R/PipeOpColApply.R index 769a87722..c57871bdf 100644 --- a/R/PipeOpColApply.R +++ b/R/PipeOpColApply.R @@ -22,6 +22,7 @@ #' ``` #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"colapply"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpColRoles.R b/R/PipeOpColRoles.R index 5e5ec2d9e..48c3461a2 100644 --- a/R/PipeOpColRoles.R +++ b/R/PipeOpColRoles.R @@ -16,6 +16,7 @@ #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"colroles"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpCollapseFactors.R b/R/PipeOpCollapseFactors.R index d3703cfbc..e41b1608b 100644 --- a/R/PipeOpCollapseFactors.R +++ b/R/PipeOpCollapseFactors.R @@ -22,6 +22,7 @@ #' ``` #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"collapsefactors"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpCopy.R b/R/PipeOpCopy.R index 8d30a0600..64711044d 100644 --- a/R/PipeOpCopy.R +++ b/R/PipeOpCopy.R @@ -18,6 +18,7 @@ #' Number of output channels, and therefore number of copies being made. #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"copy"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpDateFeatures.R b/R/PipeOpDateFeatures.R index bcb1f3f63..d5acfdf7b 100644 --- a/R/PipeOpDateFeatures.R +++ b/R/PipeOpDateFeatures.R @@ -28,6 +28,7 @@ #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"datefeatures"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpDecode.R b/R/PipeOpDecode.R index 018aed4a5..676ad620d 100644 --- a/R/PipeOpDecode.R +++ b/R/PipeOpDecode.R @@ -20,6 +20,7 @@ #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"decode"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpEncode.R b/R/PipeOpEncode.R index c3fd0d5e0..2a9c62e50 100644 --- a/R/PipeOpEncode.R +++ b/R/PipeOpEncode.R @@ -23,6 +23,7 @@ #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"encode"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpEncodeImpact.R b/R/PipeOpEncodeImpact.R index 8b342c59a..49ed32070 100644 --- a/R/PipeOpEncodeImpact.R +++ b/R/PipeOpEncodeImpact.R @@ -23,6 +23,7 @@ #' ``` #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"encodeimpact"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpEncodeLmer.R b/R/PipeOpEncodeLmer.R index 8a915dd76..552855e3a 100644 --- a/R/PipeOpEncodeLmer.R +++ b/R/PipeOpEncodeLmer.R @@ -37,6 +37,7 @@ #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"encodelmer"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpEncodePL.R b/R/PipeOpEncodePL.R index de339043d..15f9900fe 100644 --- a/R/PipeOpEncodePL.R +++ b/R/PipeOpEncodePL.R @@ -158,6 +158,7 @@ encode_piecewise_linear = function(column, bins) { #' ``` #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"encodeplquantiles"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. @@ -273,6 +274,7 @@ mlr_pipeops$add("encodeplquantiles", PipeOpEncodePLQuantiles) #' `"TaskRegr"`for [`LearnerRegrRpart`][mlr3::LearnerRegrRpart]. #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"encodeplquantiles"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpEnsemble.R b/R/PipeOpEnsemble.R index 9b6e0816c..55e9a1d63 100644 --- a/R/PipeOpEnsemble.R +++ b/R/PipeOpEnsemble.R @@ -22,6 +22,7 @@ #' Default is `FALSE`. #' * `id` :: `character(1)`\cr #' Identifier of the resulting object. +#' Deprecated, will be removed in the future. #' * `param_set` :: [`ParamSet`][paradox::ParamSet]\cr #' ("Hyper"-)Parameters in form of a [`ParamSet`][paradox::ParamSet] for the resulting [`PipeOp`]. #' * `param_vals` :: named `list`\cr diff --git a/R/PipeOpFeatureUnion.R b/R/PipeOpFeatureUnion.R index fe5a12841..b176874b7 100644 --- a/R/PipeOpFeatureUnion.R +++ b/R/PipeOpFeatureUnion.R @@ -37,6 +37,7 @@ #' Default is `FALSE`. #' * `id` :: `character(1)`\cr #' Identifier of the resulting object, default `"featureunion"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpFilter.R b/R/PipeOpFilter.R index cd2252161..40bf5f3a9 100644 --- a/R/PipeOpFilter.R +++ b/R/PipeOpFilter.R @@ -22,6 +22,7 @@ #' This argument is always cloned; to access the [`Filter`][mlr3filters::Filter] inside `PipeOpFilter` by-reference, use `$filter`.\cr #' * `id` :: `character(1)`\cr #' Identifier of the resulting object, defaulting to the `id` of the [`Filter`][mlr3filters::Filter] being used. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpFixFactors.R b/R/PipeOpFixFactors.R index 8f495de5e..c8559405c 100644 --- a/R/PipeOpFixFactors.R +++ b/R/PipeOpFixFactors.R @@ -18,6 +18,7 @@ #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"fixfactors"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpHistBin.R b/R/PipeOpHistBin.R index a20da1fab..460a9339a 100644 --- a/R/PipeOpHistBin.R +++ b/R/PipeOpHistBin.R @@ -17,6 +17,7 @@ #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"histbin"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpICA.R b/R/PipeOpICA.R index 1fb2b9d07..4e02f266a 100644 --- a/R/PipeOpICA.R +++ b/R/PipeOpICA.R @@ -15,6 +15,7 @@ #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"ica"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpImpute.R b/R/PipeOpImpute.R index ef86c2bfb..c4c287831 100644 --- a/R/PipeOpImpute.R +++ b/R/PipeOpImpute.R @@ -14,6 +14,7 @@ #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object. See `$id` slot of [`PipeOp`]. +#' Deprecated, will be removed in the future. #' * `param_set` :: [`ParamSet`][paradox::ParamSet]\cr #' Parameter space description. This should be created by the subclass and given to `super$initialize()`. #' * `param_vals` :: named `list`\cr diff --git a/R/PipeOpImputeConstant.R b/R/PipeOpImputeConstant.R index 81457c4e5..0af56d0c2 100644 --- a/R/PipeOpImputeConstant.R +++ b/R/PipeOpImputeConstant.R @@ -14,6 +14,7 @@ #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"imputeconstant"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpImputeHist.R b/R/PipeOpImputeHist.R index 63ba1eb17..2fcd040b6 100644 --- a/R/PipeOpImputeHist.R +++ b/R/PipeOpImputeHist.R @@ -21,6 +21,7 @@ #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"imputehist"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpImputeLearner.R b/R/PipeOpImputeLearner.R index bb69d3e8d..6e756ddf2 100644 --- a/R/PipeOpImputeLearner.R +++ b/R/PipeOpImputeLearner.R @@ -24,6 +24,7 @@ #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"impute."`, followed by the `id` of the `Learner`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `learner` :: [`Learner`][mlr3::Learner] | `character(1)` #' [`Learner`][mlr3::Learner] to wrap, or a string identifying a [`Learner`][mlr3::Learner] in the [`mlr3::mlr_learners`] [`Dictionary`][mlr3misc::Dictionary]. #' The [`Learner`][mlr3::Learner] usually needs to be able to handle missing values, i.e. have the `missings` property, unless care is taken diff --git a/R/PipeOpImputeMean.R b/R/PipeOpImputeMean.R index 71bf6b9ff..b30481dab 100644 --- a/R/PipeOpImputeMean.R +++ b/R/PipeOpImputeMean.R @@ -14,6 +14,7 @@ #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"imputemean"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpImputeMedian.R b/R/PipeOpImputeMedian.R index 9d37f8387..5bbba6e4f 100644 --- a/R/PipeOpImputeMedian.R +++ b/R/PipeOpImputeMedian.R @@ -14,6 +14,7 @@ #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"imputemedian"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpImputeMode.R b/R/PipeOpImputeMode.R index 563698dab..fc7e71719 100644 --- a/R/PipeOpImputeMode.R +++ b/R/PipeOpImputeMode.R @@ -15,6 +15,7 @@ #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"imputemode"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpImputeOOR.R b/R/PipeOpImputeOOR.R index e9e70ffb6..b50618789 100644 --- a/R/PipeOpImputeOOR.R +++ b/R/PipeOpImputeOOR.R @@ -38,6 +38,7 @@ #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"imputeoor"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpImputeSample.R b/R/PipeOpImputeSample.R index 523fd291b..425374cb1 100644 --- a/R/PipeOpImputeSample.R +++ b/R/PipeOpImputeSample.R @@ -14,6 +14,7 @@ #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"imputesample"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpKernelPCA.R b/R/PipeOpKernelPCA.R index da87ae52c..6834273d9 100644 --- a/R/PipeOpKernelPCA.R +++ b/R/PipeOpKernelPCA.R @@ -15,6 +15,7 @@ #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"kernelpca"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpLearner.R b/R/PipeOpLearner.R index f0555793a..c6b7f489b 100644 --- a/R/PipeOpLearner.R +++ b/R/PipeOpLearner.R @@ -24,6 +24,7 @@ #' This argument is always cloned; to access the [`Learner`][mlr3::Learner] inside `PipeOpLearner` by-reference, use `$learner`.\cr #' * `id` :: `character(1)`\cr #' Identifier of the resulting object, internally defaulting to the `id` of the [`Learner`][mlr3::Learner] being wrapped. +#' Deprecated, will be removed in the future. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpLearnerCV.R b/R/PipeOpLearnerCV.R index 947a6854b..5fb646f6b 100644 --- a/R/PipeOpLearnerCV.R +++ b/R/PipeOpLearnerCV.R @@ -33,6 +33,7 @@ #' This argument is always cloned; to access the [`Learner`][mlr3::Learner] inside `PipeOpLearnerCV` by-reference, use `$learner`.\cr #' * `id` :: `character(1)` #' Identifier of the resulting object, internally defaulting to the `id` of the [`Learner`][mlr3::Learner] being wrapped. +#' Deprecated, will be removed in the future. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpLearnerPICVPlus.R b/R/PipeOpLearnerPICVPlus.R index 5a1217767..eacbc744a 100644 --- a/R/PipeOpLearnerPICVPlus.R +++ b/R/PipeOpLearnerPICVPlus.R @@ -25,6 +25,7 @@ #' This argument is always cloned; to access the [`Learner`][mlr3::Learner] inside `PipeOpLearnerPICVPlus` by-reference, use `$learner`.\cr #' * `id` :: `character(1)` #' Identifier of the resulting object, internally defaulting to the `id` of the [`Learner`][mlr3::Learner] being wrapped. +#' Deprecated, will be removed in the future. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default is `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpLearnerQuantiles.R b/R/PipeOpLearnerQuantiles.R index 498862c85..3035a37b0 100644 --- a/R/PipeOpLearnerQuantiles.R +++ b/R/PipeOpLearnerQuantiles.R @@ -24,6 +24,7 @@ #' This argument is always cloned; to access the [`Learner`][mlr3::Learner] inside `PipeOpLearnerQuantiles` by-reference, use `$learner`. #' * `id` :: `character(1)` #' Identifier of the resulting object, internally defaulting to the `id` of the [`Learner`][mlr3::Learner] being wrapped. +#' Deprecated, will be removed in the future. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpMissingIndicators.R b/R/PipeOpMissingIndicators.R index c33bb22ba..85bd623b2 100644 --- a/R/PipeOpMissingIndicators.R +++ b/R/PipeOpMissingIndicators.R @@ -18,6 +18,7 @@ #' #' * `id` :: `character(1)` #' Identifier of the resulting object, defaulting to `"missind"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpModelMatrix.R b/R/PipeOpModelMatrix.R index 8c4645d6a..cd7d9cae5 100644 --- a/R/PipeOpModelMatrix.R +++ b/R/PipeOpModelMatrix.R @@ -14,6 +14,7 @@ #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"modelmatrix"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpMultiplicity.R b/R/PipeOpMultiplicity.R index 22834e816..944dd0df1 100644 --- a/R/PipeOpMultiplicity.R +++ b/R/PipeOpMultiplicity.R @@ -26,6 +26,7 @@ #' `innum`. #' * `id` :: `character(1)`\cr #' Identifier of the resulting object, default `"multiplicityimply"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. @@ -134,6 +135,7 @@ mlr_pipeops$add("multiplicityimply", PipeOpMultiplicityImply) #' Determines the number of output channels. #' * `id` :: `character(1)`\cr #' Identifier of the resulting object, default `"multiplicityexply"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. @@ -221,6 +223,7 @@ mlr_pipeops$add("multiplicityexply", PipeOpMultiplicityExply, list("N")) #' #' * `id` :: `character(1)` #' Identifier of the resulting object, default `"replicate"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpMutate.R b/R/PipeOpMutate.R index 85eb022fe..5fddf3a79 100644 --- a/R/PipeOpMutate.R +++ b/R/PipeOpMutate.R @@ -14,6 +14,7 @@ #' ``` #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"mutate"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpNMF.R b/R/PipeOpNMF.R index 44b96bb15..c4dc992ee 100644 --- a/R/PipeOpNMF.R +++ b/R/PipeOpNMF.R @@ -15,6 +15,7 @@ #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"nmf"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpNOP.R b/R/PipeOpNOP.R index 1f9901004..edc16126b 100644 --- a/R/PipeOpNOP.R +++ b/R/PipeOpNOP.R @@ -14,6 +14,7 @@ #' ``` #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"nop"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpNearmiss.R b/R/PipeOpNearmiss.R index 2d5342b0d..c6a099957 100644 --- a/R/PipeOpNearmiss.R +++ b/R/PipeOpNearmiss.R @@ -21,6 +21,7 @@ #' ``` #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"nearmiss"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpOVR.R b/R/PipeOpOVR.R index 39ceb8c35..ed6257576 100644 --- a/R/PipeOpOVR.R +++ b/R/PipeOpOVR.R @@ -26,6 +26,7 @@ #' ``` #' * `id` :: `character(1)`\cr #' Identifier of the resulting object, default `"ovrsplit"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. @@ -143,6 +144,7 @@ mlr_pipeops$add("ovrsplit", PipeOpOVRSplit) #' #' * `id` :: `character(1)`\cr #' Identifier of the resulting object, default `"ovrunite"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpPCA.R b/R/PipeOpPCA.R index 697ed5fd5..a6be94b89 100644 --- a/R/PipeOpPCA.R +++ b/R/PipeOpPCA.R @@ -15,6 +15,7 @@ #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"pca"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpProxy.R b/R/PipeOpProxy.R index eed3dedc8..733a4367c 100644 --- a/R/PipeOpProxy.R +++ b/R/PipeOpProxy.R @@ -21,6 +21,7 @@ #' Determines the number of output channels. #' * `id` :: `character(1)`\cr #' Identifier of resulting object. See `$id` slot of [`PipeOp`]. +#' Deprecated, will be removed in the future. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpQuantileBin.R b/R/PipeOpQuantileBin.R index 8cad0649e..6bfec4e95 100644 --- a/R/PipeOpQuantileBin.R +++ b/R/PipeOpQuantileBin.R @@ -14,6 +14,7 @@ #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"quantilebin"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpRandomProjection.R b/R/PipeOpRandomProjection.R index 4e701fe9c..cc5cc1e41 100644 --- a/R/PipeOpRandomProjection.R +++ b/R/PipeOpRandomProjection.R @@ -20,6 +20,7 @@ #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"randomprojection"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that #' would otherwise be set during construction. Default `list()`. diff --git a/R/PipeOpRandomResponse.R b/R/PipeOpRandomResponse.R index b32e339ae..d557ab841 100644 --- a/R/PipeOpRandomResponse.R +++ b/R/PipeOpRandomResponse.R @@ -24,6 +24,7 @@ #' #' * `id` :: `character(1)`\cr #' Identifier of the resulting object, default `"randomresponse"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpRegrAvg.R b/R/PipeOpRegrAvg.R index 680dfee96..56fb62662 100644 --- a/R/PipeOpRegrAvg.R +++ b/R/PipeOpRegrAvg.R @@ -29,6 +29,7 @@ #' Default is `FALSE`. #' * `id` :: `character(1)` #' Identifier of the resulting object, default `"regravg"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpRemoveConstants.R b/R/PipeOpRemoveConstants.R index 3c329df2a..2338d3894 100644 --- a/R/PipeOpRemoveConstants.R +++ b/R/PipeOpRemoveConstants.R @@ -17,6 +17,7 @@ #' #' * `id` :: `character(1)` #' Identifier of the resulting object, defaulting to `"removeconstants"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpRenameColumns.R b/R/PipeOpRenameColumns.R index aab4bc7d8..070657544 100644 --- a/R/PipeOpRenameColumns.R +++ b/R/PipeOpRenameColumns.R @@ -15,6 +15,7 @@ #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"renamecolumns"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpRowApply.R b/R/PipeOpRowApply.R index 76346f117..083a86550 100644 --- a/R/PipeOpRowApply.R +++ b/R/PipeOpRowApply.R @@ -15,6 +15,7 @@ #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"rowapply"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpScale.R b/R/PipeOpScale.R index 585638585..a9f64f2ef 100644 --- a/R/PipeOpScale.R +++ b/R/PipeOpScale.R @@ -18,6 +18,7 @@ #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"scale"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpScaleMaxAbs.R b/R/PipeOpScaleMaxAbs.R index 88809c91c..472f70c6c 100644 --- a/R/PipeOpScaleMaxAbs.R +++ b/R/PipeOpScaleMaxAbs.R @@ -16,6 +16,7 @@ #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"scalemaxabs"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpScaleRange.R b/R/PipeOpScaleRange.R index 4582976f0..b232ba5bd 100644 --- a/R/PipeOpScaleRange.R +++ b/R/PipeOpScaleRange.R @@ -18,6 +18,7 @@ #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"scalerange"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpSelect.R b/R/PipeOpSelect.R index feabf3554..48f83437a 100644 --- a/R/PipeOpSelect.R +++ b/R/PipeOpSelect.R @@ -15,6 +15,7 @@ #' ``` #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"select"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpSmote.R b/R/PipeOpSmote.R index faa17c675..b6d3e7203 100644 --- a/R/PipeOpSmote.R +++ b/R/PipeOpSmote.R @@ -16,6 +16,7 @@ #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"smote"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpSmoteNC.R b/R/PipeOpSmoteNC.R index 13c259b2d..f8d83da45 100644 --- a/R/PipeOpSmoteNC.R +++ b/R/PipeOpSmoteNC.R @@ -27,6 +27,7 @@ #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"smotenc"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpSpatialSign.R b/R/PipeOpSpatialSign.R index 67be253be..383fe2d1f 100644 --- a/R/PipeOpSpatialSign.R +++ b/R/PipeOpSpatialSign.R @@ -14,6 +14,7 @@ #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"spatialsign"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpSubsample.R b/R/PipeOpSubsample.R index 6dd9e1031..95605159a 100644 --- a/R/PipeOpSubsample.R +++ b/R/PipeOpSubsample.R @@ -17,6 +17,7 @@ #' ``` #' * `id` :: `character(1)` #' Identifier of the resulting object, default `"subsample"` +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpTaskPreproc.R b/R/PipeOpTaskPreproc.R index 426a283f6..8b5867728 100644 --- a/R/PipeOpTaskPreproc.R +++ b/R/PipeOpTaskPreproc.R @@ -328,6 +328,7 @@ PipeOpTaskPreproc = R6Class("PipeOpTaskPreproc", #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object. See `$id` slot of [`PipeOp`]. +#' Deprecated, will be removed in the future. #' * `param_set` :: [`ParamSet`][paradox::ParamSet]\cr #' Parameter space description. This should be created by the subclass and given to `super$initialize()`. #' * `param_vals` :: named `list`\cr diff --git a/R/PipeOpTextVectorizer.R b/R/PipeOpTextVectorizer.R index 2dda099b6..0f1c8b913 100644 --- a/R/PipeOpTextVectorizer.R +++ b/R/PipeOpTextVectorizer.R @@ -41,6 +41,7 @@ #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"textvectorizer"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpThreshold.R b/R/PipeOpThreshold.R index 88f81ed26..2c2a7a1ec 100644 --- a/R/PipeOpThreshold.R +++ b/R/PipeOpThreshold.R @@ -16,6 +16,7 @@ #' #' * `id` :: `character(1)` #' Identifier of the resulting object, default `"threshold"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpTomek.R b/R/PipeOpTomek.R index 600a07ee7..0b2cc766d 100644 --- a/R/PipeOpTomek.R +++ b/R/PipeOpTomek.R @@ -22,6 +22,7 @@ #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"tomek"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpTrafo.R b/R/PipeOpTrafo.R index 05360602d..aea8a9663 100644 --- a/R/PipeOpTrafo.R +++ b/R/PipeOpTrafo.R @@ -196,6 +196,7 @@ PipeOpTargetTrafo = R6Class("PipeOpTargetTrafo", #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"targetinvert"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. @@ -268,6 +269,7 @@ mlr_pipeops$add("targetinvert", PipeOpTargetInvert) #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"targetmutate"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. @@ -414,6 +416,7 @@ mlr_pipeops$add("targetmutate", PipeOpTargetMutate) #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"targettrafoscalerange"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpTuneThreshold.R b/R/PipeOpTuneThreshold.R index 57b9b9ad0..7c21fb328 100644 --- a/R/PipeOpTuneThreshold.R +++ b/R/PipeOpTuneThreshold.R @@ -25,6 +25,7 @@ #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object. Default: "tunethreshold". +#' Deprecated, will be removed in the future. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpUnbranch.R b/R/PipeOpUnbranch.R index fdd2117a3..08d7170be 100644 --- a/R/PipeOpUnbranch.R +++ b/R/PipeOpUnbranch.R @@ -24,6 +24,7 @@ #' is always viable. #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"unbranch"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpVtreat.R b/R/PipeOpVtreat.R index 45b52c7f5..b38c45cbc 100644 --- a/R/PipeOpVtreat.R +++ b/R/PipeOpVtreat.R @@ -19,6 +19,7 @@ #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"vtreat"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. diff --git a/R/PipeOpYeoJohnson.R b/R/PipeOpYeoJohnson.R index 9f3062c90..8939935eb 100644 --- a/R/PipeOpYeoJohnson.R +++ b/R/PipeOpYeoJohnson.R @@ -16,6 +16,7 @@ #' #' * `id` :: `character(1)`\cr #' Identifier of resulting object, default `"yeojohnson"`. +#' Deprecated, will be removed in the future. Use the [po()] syntax to set a custom ID on construction. #' * `param_vals` :: named `list`\cr #' List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default `list()`. #' Deprecated, will be removed in the future. Use the [po()] syntax to set hyperparameters on construction. From 4de0ad59eb7097eb0ba2b26194fd74efc00df131 Mon Sep 17 00:00:00 2001 From: mb706 Date: Thu, 14 Aug 2025 23:28:19 +0200 Subject: [PATCH 16/31] tests fix --- tests/testthat/test_dictionary.R | 7 ++++--- tests/testthat/test_pipeop_colroles.R | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/testthat/test_dictionary.R b/tests/testthat/test_dictionary.R index baf6d0252..91f3293ca 100644 --- a/tests/testthat/test_dictionary.R +++ b/tests/testthat/test_dictionary.R @@ -90,9 +90,10 @@ test_that("Dictionary contains all PipeOps", { dictname = dictnames[idx] # the "key" in the mlr_pipeops dictionary args = initargs[[pipeops[idx]]] %??% list() # the required arguments, if any. e.g. 'outnum' for PipeOpCopy. - test_obj = do.call(pogen$new, args) # test_obj: PipeOp object, constructed from constructor - - + test_obj = do.call(pogen$new, args[names(args) != "param_vals"]) # test_obj: PipeOp object, constructed from constructor + if ("param_vals" %in% names(args)) { + test_obj$param_set$set_values(.values = args$param_vals) + } # check that mlr_pipeops key is the default ID if (pipeops[idx] %nin% unequal_id) { diff --git a/tests/testthat/test_pipeop_colroles.R b/tests/testthat/test_pipeop_colroles.R index 11cf99bfd..53b9998fd 100644 --- a/tests/testthat/test_pipeop_colroles.R +++ b/tests/testthat/test_pipeop_colroles.R @@ -63,7 +63,7 @@ test_that("PipeOpColRoles - new_role works", { task$cbind(data.table(rn = sprintf("%03d", 1:150))) op = po("colroles", new_role = list( - rn = "name", Petal.Length = c("feature", "order"), Petal.Width = character(0), Sepal.Width = NULL)) + rn = "name", Petal.Length = c("feature", "order"), Petal.Width = character(0), Sepal.Width = NULL) ) train_out = train_pipeop(op, inputs = list(task))[[1L]] From bc18dcaf7b69ed9e1e78fe10f6050e99642ec3d5 Mon Sep 17 00:00:00 2001 From: mb706 Date: Thu, 14 Aug 2025 23:31:42 +0200 Subject: [PATCH 17/31] document() --- man/PipeOp.Rd | 2 ++ man/PipeOpEncodePL.Rd | 5 +++-- man/PipeOpEnsemble.Rd | 2 ++ man/PipeOpImpute.Rd | 6 ++++-- man/PipeOpTargetTrafo.Rd | 1 + man/PipeOpTaskPreproc.Rd | 5 +++-- man/PipeOpTaskPreprocSimple.Rd | 6 ++++-- man/mlr_learners_graph.Rd | 1 + man/mlr_pipeops_adas.Rd | 2 ++ man/mlr_pipeops_blsmote.Rd | 2 ++ man/mlr_pipeops_boxcox.Rd | 2 ++ man/mlr_pipeops_branch.Rd | 2 ++ man/mlr_pipeops_chunk.Rd | 2 ++ man/mlr_pipeops_classbalancing.Rd | 2 ++ man/mlr_pipeops_classifavg.Rd | 2 ++ man/mlr_pipeops_classweights.Rd | 2 ++ man/mlr_pipeops_colapply.Rd | 4 +++- man/mlr_pipeops_collapsefactors.Rd | 2 ++ man/mlr_pipeops_colroles.Rd | 5 +++-- man/mlr_pipeops_copy.Rd | 2 ++ man/mlr_pipeops_datefeatures.Rd | 5 +++-- man/mlr_pipeops_decode.Rd | 2 ++ man/mlr_pipeops_encode.Rd | 2 ++ man/mlr_pipeops_encodeimpact.Rd | 5 +++-- man/mlr_pipeops_encodelmer.Rd | 5 +++-- man/mlr_pipeops_encodeplquantiles.Rd | 2 ++ man/mlr_pipeops_encodepltree.Rd | 10 ++++++---- man/mlr_pipeops_featureunion.Rd | 5 +++-- man/mlr_pipeops_filter.Rd | 2 ++ man/mlr_pipeops_fixfactors.Rd | 2 ++ man/mlr_pipeops_histbin.Rd | 2 ++ man/mlr_pipeops_ica.Rd | 2 ++ man/mlr_pipeops_imputeconstant.Rd | 5 +++-- man/mlr_pipeops_imputehist.Rd | 2 ++ man/mlr_pipeops_imputelearner.Rd | 2 ++ man/mlr_pipeops_imputemean.Rd | 2 ++ man/mlr_pipeops_imputemedian.Rd | 2 ++ man/mlr_pipeops_imputemode.Rd | 2 ++ man/mlr_pipeops_imputeoor.Rd | 2 ++ man/mlr_pipeops_imputesample.Rd | 2 ++ man/mlr_pipeops_kernelpca.Rd | 2 ++ man/mlr_pipeops_learner.Rd | 2 ++ man/mlr_pipeops_learner_cv.Rd | 2 ++ man/mlr_pipeops_learner_pi_cvplus.Rd | 5 +++-- man/mlr_pipeops_learner_quantiles.Rd | 2 ++ man/mlr_pipeops_missind.Rd | 2 ++ man/mlr_pipeops_modelmatrix.Rd | 2 ++ man/mlr_pipeops_multiplicityexply.Rd | 5 +++-- man/mlr_pipeops_multiplicityimply.Rd | 5 +++-- man/mlr_pipeops_mutate.Rd | 2 ++ man/mlr_pipeops_nearmiss.Rd | 2 ++ man/mlr_pipeops_nmf.Rd | 5 +++-- man/mlr_pipeops_nop.Rd | 2 ++ man/mlr_pipeops_ovrsplit.Rd | 2 ++ man/mlr_pipeops_ovrunite.Rd | 2 ++ man/mlr_pipeops_pca.Rd | 2 ++ man/mlr_pipeops_proxy.Rd | 5 +++-- man/mlr_pipeops_quantilebin.Rd | 2 ++ man/mlr_pipeops_randomprojection.Rd | 1 + man/mlr_pipeops_randomresponse.Rd | 5 +++-- man/mlr_pipeops_regravg.Rd | 2 ++ man/mlr_pipeops_removeconstants.Rd | 2 ++ man/mlr_pipeops_renamecolumns.Rd | 2 ++ man/mlr_pipeops_replicate.Rd | 5 +++-- man/mlr_pipeops_rowapply.Rd | 2 ++ man/mlr_pipeops_scale.Rd | 2 ++ man/mlr_pipeops_scalemaxabs.Rd | 2 ++ man/mlr_pipeops_scalerange.Rd | 2 ++ man/mlr_pipeops_select.Rd | 2 ++ man/mlr_pipeops_smote.Rd | 2 ++ man/mlr_pipeops_smotenc.Rd | 2 ++ man/mlr_pipeops_spatialsign.Rd | 2 ++ man/mlr_pipeops_subsample.Rd | 2 ++ man/mlr_pipeops_targetinvert.Rd | 2 ++ man/mlr_pipeops_targetmutate.Rd | 5 +++-- man/mlr_pipeops_targettrafoscalerange.Rd | 5 +++-- man/mlr_pipeops_textvectorizer.Rd | 2 ++ man/mlr_pipeops_threshold.Rd | 3 ++- man/mlr_pipeops_tomek.Rd | 2 ++ man/mlr_pipeops_tunethreshold.Rd | 7 ++++--- man/mlr_pipeops_unbranch.Rd | 2 ++ man/mlr_pipeops_updatetarget.Rd | 1 + man/mlr_pipeops_vtreat.Rd | 2 ++ man/mlr_pipeops_yeojohnson.Rd | 2 ++ man/set_validate.GraphLearner.Rd | 4 ++-- 85 files changed, 194 insertions(+), 49 deletions(-) diff --git a/man/PipeOp.Rd b/man/PipeOp.Rd index f5921c3a0..69e90bbd4 100644 --- a/man/PipeOp.Rd +++ b/man/PipeOp.Rd @@ -43,6 +43,7 @@ is not intended to be instantiated. \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object. See \verb{$id} slot. +Deprecated, will be removed in the future. \item \code{param_set} :: \code{\link[paradox:ParamSet]{ParamSet}} | \code{list} of \code{expression}\cr Parameter space description. This should be created by the subclass and given to \code{super$initialize()}. If this is a \code{\link[paradox:ParamSet]{ParamSet}}, it is used as the \code{PipeOp}'s \code{\link[paradox:ParamSet]{ParamSet}} @@ -51,6 +52,7 @@ These \code{\link[paradox:ParamSet]{ParamSet}} are combined using a \code{\link[ \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings given in \code{param_set}. The subclass should have its own \code{param_vals} parameter and pass it on to \code{super$initialize()}. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. \item \code{input} :: \code{\link[data.table:data.table]{data.table}} with columns \code{name} (\code{character}), \code{train} (\code{character}), \code{predict} (\code{character})\cr Sets the \verb{$input} slot of the resulting object; see description there. \item \code{output} :: \code{\link[data.table:data.table]{data.table}} with columns \code{name} (\code{character}), \code{train} (\code{character}), \code{predict} (\code{character})\cr diff --git a/man/PipeOpEncodePL.Rd b/man/PipeOpEncodePL.Rd index 4407d32a0..277d11919 100644 --- a/man/PipeOpEncodePL.Rd +++ b/man/PipeOpEncodePL.Rd @@ -33,8 +33,9 @@ Identifier of resulting object. See \verb{$id} slot of \code{\link{PipeOp}}. \item \code{param_set} :: \code{\link[paradox:ParamSet]{ParamSet}}\cr Parameter space description. This should be created by the subclass and given to \code{super$initialize()}. \item \code{param_vals} :: named \code{list}\cr -List of hyperparameter settings, overwriting the hyperparameter settings given in \code{param_set}. The -subclass should have its own \code{param_vals} parameter and pass it on to \code{super$initialize()}. Default \code{list()}. +List of hyperparameter settings, overwriting the hyperparameter settings given in \code{param_set}. +The subclass should have its own \code{param_vals} parameter and pass it on to \code{super$initialize()}. Default \code{list()}. +Deprecated, will be removed in the future. \item \code{packages} :: \code{character}\cr Set of all required packages for the \code{\link{PipeOp}}'s \code{private$.train()} and \code{private$.predict()} methods. See \verb{$packages} slot. Default is \code{character(0)}. diff --git a/man/PipeOpEnsemble.Rd b/man/PipeOpEnsemble.Rd index 415859086..ead379b3f 100644 --- a/man/PipeOpEnsemble.Rd +++ b/man/PipeOpEnsemble.Rd @@ -26,10 +26,12 @@ If \code{TRUE}, the input is a \code{\link{Multiplicity}} collecting channel. Th Default is \code{FALSE}. \item \code{id} :: \code{character(1)}\cr Identifier of the resulting object. +Deprecated, will be removed in the future. \item \code{param_set} :: \code{\link[paradox:ParamSet]{ParamSet}}\cr ("Hyper"-)Parameters in form of a \code{\link[paradox:ParamSet]{ParamSet}} for the resulting \code{\link{PipeOp}}. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. \item \code{packages} :: \code{character}\cr Set of packages required for this \code{PipeOp}. These packages are loaded during \verb{$train()} and \verb{$predict()}, but not attached. Default \code{character(0)}. diff --git a/man/PipeOpImpute.Rd b/man/PipeOpImpute.Rd index b8a2aa73f..f43b981ed 100644 --- a/man/PipeOpImpute.Rd +++ b/man/PipeOpImpute.Rd @@ -18,11 +18,13 @@ Abstract base class for feature imputation. \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object. See \verb{$id} slot of \code{\link{PipeOp}}. +Deprecated, will be removed in the future. \item \code{param_set} :: \code{\link[paradox:ParamSet]{ParamSet}}\cr Parameter space description. This should be created by the subclass and given to \code{super$initialize()}. \item \code{param_vals} :: named \code{list}\cr -List of hyperparameter settings, overwriting the hyperparameter settings given in \code{param_set}. The -subclass should have its own \code{param_vals} parameter and pass it on to \code{super$initialize()}. Default \code{list()}. +List of hyperparameter settings, overwriting the hyperparameter settings given in \code{param_set}. +The subclass should have its own \code{param_vals} parameter and pass it on to \code{super$initialize()}. Default \code{list()}. +Deprecated, will be removed in the future. \item \code{whole_task_dependent} :: \code{logical(1)}\cr Whether the \code{context_columns} parameter should be added which lets the user limit the columns that are used for imputation inference. This should generally be \code{FALSE} if imputation depends only on individual features diff --git a/man/PipeOpTargetTrafo.Rd b/man/PipeOpTargetTrafo.Rd index 99d957a39..e67a853d7 100644 --- a/man/PipeOpTargetTrafo.Rd +++ b/man/PipeOpTargetTrafo.Rd @@ -30,6 +30,7 @@ Parameter space description. This should be created by the subclass and given to List of hyperparameter settings, overwriting the hyperparameter settings given in \code{param_set}. The subclass should have its own \code{param_vals} parameter and pass it on to \code{super$initialize()}. Default \code{list()}. +Deprecated, will be removed in the future. \item \code{task_type_in} :: \code{character(1)}\cr The class of \code{\link[mlr3:Task]{Task}} that should be accepted as input. This should generally be a \code{character(1)} identifying a type of \code{\link[mlr3:Task]{Task}}, e.g. \code{"Task"}, \code{"TaskClassif"} or \code{"TaskRegr"} (or another subclass diff --git a/man/PipeOpTaskPreproc.Rd b/man/PipeOpTaskPreproc.Rd index 75afdab08..57f3483a5 100644 --- a/man/PipeOpTaskPreproc.Rd +++ b/man/PipeOpTaskPreproc.Rd @@ -49,8 +49,9 @@ Identifier of resulting object. See \verb{$id} slot of \code{\link{PipeOp}}. \item \code{param_set} :: \code{\link[paradox:ParamSet]{ParamSet}}\cr Parameter space description. This should be created by the subclass and given to \code{super$initialize()}. \item \code{param_vals} :: named \code{list}\cr -List of hyperparameter settings, overwriting the hyperparameter settings given in \code{param_set}. The -subclass should have its own \code{param_vals} parameter and pass it on to \code{super$initialize()}. Default \code{list()}. +List of hyperparameter settings, overwriting the hyperparameter settings given in \code{param_set}. +The subclass should have its own \code{param_vals} parameter and pass it on to \code{super$initialize()}. Default \code{list()}. +Deprecated, will be removed in the future. \item \code{can_subset_cols} :: \code{logical(1)}\cr Whether the \code{affect_columns} parameter should be added which lets the user limit the columns that are modified by the \code{PipeOpTaskPreproc}. This should generally be \code{FALSE} if the operation adds or removes diff --git a/man/PipeOpTaskPreprocSimple.Rd b/man/PipeOpTaskPreprocSimple.Rd index 9463f488d..593ff80b6 100644 --- a/man/PipeOpTaskPreprocSimple.Rd +++ b/man/PipeOpTaskPreprocSimple.Rd @@ -34,11 +34,13 @@ This inherits from \code{\link{PipeOpTaskPreproc}} and behaves essentially the s \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object. See \verb{$id} slot of \code{\link{PipeOp}}. +Deprecated, will be removed in the future. \item \code{param_set} :: \code{\link[paradox:ParamSet]{ParamSet}}\cr Parameter space description. This should be created by the subclass and given to \code{super$initialize()}. \item \code{param_vals} :: named \code{list}\cr -List of hyperparameter settings, overwriting the hyperparameter settings given in \code{param_set}. The -subclass should have its own \code{param_vals} parameter and pass it on to \code{super$initialize()}. Default \code{list()}. +List of hyperparameter settings, overwriting the hyperparameter settings given in \code{param_set}. +The subclass should have its own \code{param_vals} parameter and pass it on to \code{super$initialize()}. Default \code{list()}. +Deprecated, will be removed in the future. \item \code{can_subset_cols} :: \code{logical(1)}\cr Whether the \code{affect_columns} parameter should be added which lets the user limit the columns that are modified by the \code{PipeOpTaskPreprocSimple}. This should generally be \code{FALSE} if the operation adds or removes diff --git a/man/mlr_learners_graph.Rd b/man/mlr_learners_graph.Rd index bf684365b..32aca6925 100644 --- a/man/mlr_learners_graph.Rd +++ b/man/mlr_learners_graph.Rd @@ -36,6 +36,7 @@ This argument is usually cloned, unless \code{clone_graph} is \code{FALSE}; to a Identifier of the resulting \code{\link[mlr3:Learner]{Learner}}. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings . Default \code{list()}. +Deprecated, will be removed in the future. \item \code{task_type} :: \code{character(1)}\cr What \code{task_type} the \code{GraphLearner} should have; usually automatically inferred for \code{\link{Graph}}s that are simple enough. \item \code{predict_type} :: \code{character(1)}\cr diff --git a/man/mlr_pipeops_adas.Rd b/man/mlr_pipeops_adas.Rd index 33a094003..b7a6de60b 100644 --- a/man/mlr_pipeops_adas.Rd +++ b/man/mlr_pipeops_adas.Rd @@ -23,8 +23,10 @@ See \code{\link[smotefamily:adas]{smotefamily::ADAS}} for details. \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"adas"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_blsmote.Rd b/man/mlr_pipeops_blsmote.Rd index 08c6b0d8d..66b6e2ef1 100644 --- a/man/mlr_pipeops_blsmote.Rd +++ b/man/mlr_pipeops_blsmote.Rd @@ -20,8 +20,10 @@ See \code{\link[smotefamily:BLSMOTE]{smotefamily::BLSMOTE}} for details. \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"smote"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_boxcox.Rd b/man/mlr_pipeops_boxcox.Rd index 1b672f56c..dea49b1e1 100644 --- a/man/mlr_pipeops_boxcox.Rd +++ b/man/mlr_pipeops_boxcox.Rd @@ -21,8 +21,10 @@ See \code{\link[bestNormalize:boxcox]{bestNormalize::boxcox()}} for details. \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"boxcox"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_branch.Rd b/man/mlr_pipeops_branch.Rd index db449402b..5676e8d40 100644 --- a/man/mlr_pipeops_branch.Rd +++ b/man/mlr_pipeops_branch.Rd @@ -29,8 +29,10 @@ If \code{options} is a \code{character}, it determines the names of channels dir The \verb{$selection} parameter will then be factorial. \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"branch"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_chunk.Rd b/man/mlr_pipeops_chunk.Rd index c82b399bf..8c39ed971 100644 --- a/man/mlr_pipeops_chunk.Rd +++ b/man/mlr_pipeops_chunk.Rd @@ -22,8 +22,10 @@ simply passes on the input during \code{outnum} times during prediction. Number of output channels, and therefore number of chunks created. \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"chunk"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_classbalancing.Rd b/man/mlr_pipeops_classbalancing.Rd index fd95b8cdc..6a6efd6cb 100644 --- a/man/mlr_pipeops_classbalancing.Rd +++ b/man/mlr_pipeops_classbalancing.Rd @@ -22,8 +22,10 @@ beneficial for classification with imbalanced training data. \itemize{ \item \code{id} :: \code{character(1)} Identifier of the resulting object, default \code{"classbalancing"} +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_classifavg.Rd b/man/mlr_pipeops_classifavg.Rd index beb232e55..7975740bd 100644 --- a/man/mlr_pipeops_classifavg.Rd +++ b/man/mlr_pipeops_classifavg.Rd @@ -38,8 +38,10 @@ If \code{TRUE}, the input is a \code{\link{Multiplicity}} collecting channel. Th Default is \code{FALSE}. \item \code{id} :: \code{character(1)} Identifier of the resulting object, default \code{"classifavg"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_classweights.Rd b/man/mlr_pipeops_classweights.Rd index 678b0c4fa..eaec6de71 100644 --- a/man/mlr_pipeops_classweights.Rd +++ b/man/mlr_pipeops_classweights.Rd @@ -27,8 +27,10 @@ It therefore influences the behaviour of subsequent \code{\link[mlr3:Learner]{Le \itemize{ \item \code{id} :: \code{character(1)} Identifier of the resulting object, default \code{"classweights"} +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_colapply.Rd b/man/mlr_pipeops_colapply.Rd index 41b07ff74..3ec8ed7a6 100644 --- a/man/mlr_pipeops_colapply.Rd +++ b/man/mlr_pipeops_colapply.Rd @@ -27,8 +27,10 @@ from \code{Vectorize(f)}, it is not a function that should be used for \code{app \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"colapply"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } @@ -62,7 +64,7 @@ Use \code{\link[base:Vectorize]{Vectorize}} to create a vectorizing function fro \section{Internals}{ -Calls \code{\link[mlr3misc:map]{map}} on the data, using the value of \code{applicator} as \code{f.} and coerces the output via \code{\link{as.data.table}}. +Calls \code{\link[mlr3misc:compat-map]{map}} on the data, using the value of \code{applicator} as \code{f.} and coerces the output via \code{\link{as.data.table}}. } \section{Fields}{ diff --git a/man/mlr_pipeops_collapsefactors.Rd b/man/mlr_pipeops_collapsefactors.Rd index 60044c35b..86f9b1a2c 100644 --- a/man/mlr_pipeops_collapsefactors.Rd +++ b/man/mlr_pipeops_collapsefactors.Rd @@ -27,8 +27,10 @@ Levels not seen during training are not touched during prediction; Therefore it \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"collapsefactors"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_colroles.Rd b/man/mlr_pipeops_colroles.Rd index 6fe93c31a..d11de1038 100644 --- a/man/mlr_pipeops_colroles.Rd +++ b/man/mlr_pipeops_colroles.Rd @@ -20,9 +20,10 @@ Setting a new target variable or changing the role of an existing target variabl \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"colroles"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr -List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise -be set during construction. Default \code{list()}. +List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_copy.Rd b/man/mlr_pipeops_copy.Rd index be1a51822..c635aea5a 100644 --- a/man/mlr_pipeops_copy.Rd +++ b/man/mlr_pipeops_copy.Rd @@ -22,8 +22,10 @@ Copies its input \code{outnum} times. This \code{\link{PipeOp}} usually not need Number of output channels, and therefore number of copies being made. \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"copy"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_datefeatures.Rd b/man/mlr_pipeops_datefeatures.Rd index 8eeda0e8a..4c2375fa4 100644 --- a/man/mlr_pipeops_datefeatures.Rd +++ b/man/mlr_pipeops_datefeatures.Rd @@ -32,9 +32,10 @@ minute. \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"datefeatures"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr -List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise -be set during construction. Default \code{list()}. +List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_decode.Rd b/man/mlr_pipeops_decode.Rd index 76b08510b..a11bfc4ea 100644 --- a/man/mlr_pipeops_decode.Rd +++ b/man/mlr_pipeops_decode.Rd @@ -24,8 +24,10 @@ determined as the name of the column with the maximum value in the group. \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"decode"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_encode.Rd b/man/mlr_pipeops_encode.Rd index bc286e459..7318df674 100644 --- a/man/mlr_pipeops_encode.Rd +++ b/man/mlr_pipeops_encode.Rd @@ -27,8 +27,10 @@ Use the \code{\link{PipeOpTaskPreproc}} \verb{$affect_columns} functionality to \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"encode"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_encodeimpact.Rd b/man/mlr_pipeops_encodeimpact.Rd index 33776ca10..68fc1b262 100644 --- a/man/mlr_pipeops_encodeimpact.Rd +++ b/man/mlr_pipeops_encodeimpact.Rd @@ -28,9 +28,10 @@ Treats new levels during prediction like missing values. \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"encodeimpact"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr -List of hyperparameter settings, overwriting the hyperparameter settings that would -otherwise be set during construction. Default \code{list()}. +List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_encodelmer.Rd b/man/mlr_pipeops_encodelmer.Rd index 33cb75759..bfcd25814 100644 --- a/man/mlr_pipeops_encodelmer.Rd +++ b/man/mlr_pipeops_encodelmer.Rd @@ -41,9 +41,10 @@ columns, or only encode columns of a certain type. \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"encodelmer"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr -List of hyperparameter settings, overwriting the hyperparameter settings that would -otherwise be set during construction. Default \code{list()}. +List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_encodeplquantiles.Rd b/man/mlr_pipeops_encodeplquantiles.Rd index 700611995..18cab8e4e 100644 --- a/man/mlr_pipeops_encodeplquantiles.Rd +++ b/man/mlr_pipeops_encodeplquantiles.Rd @@ -24,8 +24,10 @@ Affected feature columns may contain \code{NA}s. These are ignored when calculat \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"encodeplquantiles"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_encodepltree.Rd b/man/mlr_pipeops_encodepltree.Rd index 4013473cd..94166d0d2 100644 --- a/man/mlr_pipeops_encodepltree.Rd +++ b/man/mlr_pipeops_encodepltree.Rd @@ -23,12 +23,14 @@ column into account, and using decision boundaries as bin boundaries. \item \code{task_type} :: \code{character(1)}\cr The class of \code{\link[mlr3:Task]{Task}} that should be accepted as input, given as a \code{character(1)}. This is used to construct the appropriate \code{\link[mlr3:Learner]{Learner}} to be used for obtaining the bins for piecewise linear -encoding. Supported options are \code{"TaskClassif"}for \code{\link[mlr3:LearnerClassifRpart]{LearnerClassifRpart}} or -\code{"TaskRegr"}for \code{\link[mlr3:LearnerRegrRpart]{LearnerRegrRpart}}. +encoding. Supported options are \code{"TaskClassif"}for \code{\link[mlr3:mlr_learners_classif.rpart]{LearnerClassifRpart}} or +\code{"TaskRegr"}for \code{\link[mlr3:mlr_learners_regr.rpart]{LearnerRegrRpart}}. \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"encodeplquantiles"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } @@ -57,8 +59,8 @@ the \code{\link[mlr3:Learner]{Learner}} used for obtaining the bins for piecewis This overloads the \code{private$.get_bins()} method of \code{\link{PipeOpEncodePL}}. To derive the bins for each feature, the \code{\link[mlr3:Task]{Task}} is split into smaller \code{\link[mlr3:Task]{Tasks}} with only the target and respective feature as columns. -On these \code{\link[mlr3:Task]{Tasks}} either a \code{\link[mlr3:LearnerClassifRpart]{LearnerClassifRpart}} or -\code{\link[mlr3:LearnerRegrRpart]{LearnerRegrRpart}} gets trained and the respective splits extracted as bin boundaries used +On these \code{\link[mlr3:Task]{Tasks}} either a \code{\link[mlr3:mlr_learners_classif.rpart]{LearnerClassifRpart}} or +\code{\link[mlr3:mlr_learners_regr.rpart]{LearnerRegrRpart}} gets trained and the respective splits extracted as bin boundaries used for piecewise linear encodings. } diff --git a/man/mlr_pipeops_featureunion.Rd b/man/mlr_pipeops_featureunion.Rd index de03f667a..95b8b7aa8 100644 --- a/man/mlr_pipeops_featureunion.Rd +++ b/man/mlr_pipeops_featureunion.Rd @@ -41,9 +41,10 @@ If \code{TRUE}, the input is a \code{\link{Multiplicity}} collecting channel. Th Default is \code{FALSE}. \item \code{id} :: \code{character(1)}\cr Identifier of the resulting object, default \code{"featureunion"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr -List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise -be set during construction. Default \code{list()}. +List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. \item \code{assert_targets_equal} :: \code{logical(1)}\cr If \code{assert_targets_equal} is \code{TRUE} (Default), task target column names are checked for agreement. Disagreeing target column names are usually a bug, so this should often be left at diff --git a/man/mlr_pipeops_filter.Rd b/man/mlr_pipeops_filter.Rd index 308e66011..8bc0f2dc5 100644 --- a/man/mlr_pipeops_filter.Rd +++ b/man/mlr_pipeops_filter.Rd @@ -26,8 +26,10 @@ this means e.g. that setting \code{nfeat} to 0 will only remove features of the This argument is always cloned; to access the \code{\link[mlr3filters:Filter]{Filter}} inside \code{PipeOpFilter} by-reference, use \verb{$filter}.\cr \item \code{id} :: \code{character(1)}\cr Identifier of the resulting object, defaulting to the \code{id} of the \code{\link[mlr3filters:Filter]{Filter}} being used. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_fixfactors.Rd b/man/mlr_pipeops_fixfactors.Rd index 2eba59b67..3af5d6efe 100644 --- a/man/mlr_pipeops_fixfactors.Rd +++ b/man/mlr_pipeops_fixfactors.Rd @@ -22,8 +22,10 @@ Note this may introduce \emph{missing values} during prediction if unseen factor \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"fixfactors"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_histbin.Rd b/man/mlr_pipeops_histbin.Rd index 3baeeb225..e21539959 100644 --- a/man/mlr_pipeops_histbin.Rd +++ b/man/mlr_pipeops_histbin.Rd @@ -21,8 +21,10 @@ binned with the lowest / highest bin respectively. \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"histbin"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_ica.Rd b/man/mlr_pipeops_ica.Rd index 6de1101d2..cfdf951f2 100644 --- a/man/mlr_pipeops_ica.Rd +++ b/man/mlr_pipeops_ica.Rd @@ -19,8 +19,10 @@ See \link[fastICA:fastICA]{fastICA::fastICA} for details. \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"ica"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_imputeconstant.Rd b/man/mlr_pipeops_imputeconstant.Rd index c2d42877b..8f87d47bc 100644 --- a/man/mlr_pipeops_imputeconstant.Rd +++ b/man/mlr_pipeops_imputeconstant.Rd @@ -18,9 +18,10 @@ Impute features by a constant value. \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"imputeconstant"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr -List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise -be set during construction. Default \code{list()}. +List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_imputehist.Rd b/man/mlr_pipeops_imputehist.Rd index a53263e3e..441c2e64e 100644 --- a/man/mlr_pipeops_imputehist.Rd +++ b/man/mlr_pipeops_imputehist.Rd @@ -25,8 +25,10 @@ does not need to save the training data. \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"imputehist"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_imputelearner.Rd b/man/mlr_pipeops_imputelearner.Rd index fb7c920a9..5fa887790 100644 --- a/man/mlr_pipeops_imputelearner.Rd +++ b/man/mlr_pipeops_imputelearner.Rd @@ -28,6 +28,7 @@ own imputation (see examples). \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"impute."}, followed by the \code{id} of the \code{Learner}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{learner} :: \code{\link[mlr3:Learner]{Learner}} | \code{character(1)} \code{\link[mlr3:Learner]{Learner}} to wrap, or a string identifying a \code{\link[mlr3:Learner]{Learner}} in the \code{\link[mlr3:mlr_learners]{mlr3::mlr_learners}} \code{\link[mlr3misc:Dictionary]{Dictionary}}. The \code{\link[mlr3:Learner]{Learner}} usually needs to be able to handle missing values, i.e. have the \code{missings} property, unless care is taken @@ -35,6 +36,7 @@ that \code{context_columns} do not contain missings; see examples.\cr This argument is always cloned; to access the \code{\link[mlr3:Learner]{Learner}} inside \code{PipeOpImputeLearner} by-reference, use \verb{$learner}.\cr \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_imputemean.Rd b/man/mlr_pipeops_imputemean.Rd index a4b33fa0f..6f407aafc 100644 --- a/man/mlr_pipeops_imputemean.Rd +++ b/man/mlr_pipeops_imputemean.Rd @@ -18,8 +18,10 @@ Impute numerical features by their mean. \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"imputemean"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_imputemedian.Rd b/man/mlr_pipeops_imputemedian.Rd index 8655e1ecc..dbf44b4b5 100644 --- a/man/mlr_pipeops_imputemedian.Rd +++ b/man/mlr_pipeops_imputemedian.Rd @@ -18,8 +18,10 @@ Impute numerical features by their median. \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"imputemedian"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_imputemode.Rd b/man/mlr_pipeops_imputemode.Rd index b35b83b13..71fc915fb 100644 --- a/man/mlr_pipeops_imputemode.Rd +++ b/man/mlr_pipeops_imputemode.Rd @@ -19,8 +19,10 @@ If multiple modes are present then imputed values are sampled randomly from them \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"imputemode"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_imputeoor.Rd b/man/mlr_pipeops_imputeoor.Rd index 187c23acf..a744df618 100644 --- a/man/mlr_pipeops_imputeoor.Rd +++ b/man/mlr_pipeops_imputeoor.Rd @@ -42,8 +42,10 @@ after this \code{PipeOp}. \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"imputeoor"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_imputesample.Rd b/man/mlr_pipeops_imputesample.Rd index e80476851..fd33aa1e6 100644 --- a/man/mlr_pipeops_imputesample.Rd +++ b/man/mlr_pipeops_imputesample.Rd @@ -18,8 +18,10 @@ Impute features by sampling from non-missing training data. \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"imputesample"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_kernelpca.Rd b/man/mlr_pipeops_kernelpca.Rd index b18f5806f..05f61874e 100644 --- a/man/mlr_pipeops_kernelpca.Rd +++ b/man/mlr_pipeops_kernelpca.Rd @@ -19,8 +19,10 @@ See \link[kernlab:kpca]{kernlab::kpca} for details. \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"kernelpca"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_learner.Rd b/man/mlr_pipeops_learner.Rd index aab63683b..6639c2807 100644 --- a/man/mlr_pipeops_learner.Rd +++ b/man/mlr_pipeops_learner.Rd @@ -28,8 +28,10 @@ and tuning. This argument is always cloned; to access the \code{\link[mlr3:Learner]{Learner}} inside \code{PipeOpLearner} by-reference, use \verb{$learner}.\cr \item \code{id} :: \code{character(1)}\cr Identifier of the resulting object, internally defaulting to the \code{id} of the \code{\link[mlr3:Learner]{Learner}} being wrapped. +Deprecated, will be removed in the future. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_learner_cv.Rd b/man/mlr_pipeops_learner_cv.Rd index 4dfd38111..78fbc9eb6 100644 --- a/man/mlr_pipeops_learner_cv.Rd +++ b/man/mlr_pipeops_learner_cv.Rd @@ -37,8 +37,10 @@ useful to use \code{\link{PipeOpFeatureUnion}} to bind the prediction \code{\lin This argument is always cloned; to access the \code{\link[mlr3:Learner]{Learner}} inside \code{PipeOpLearnerCV} by-reference, use \verb{$learner}.\cr \item \code{id} :: \code{character(1)} Identifier of the resulting object, internally defaulting to the \code{id} of the \code{\link[mlr3:Learner]{Learner}} being wrapped. +Deprecated, will be removed in the future. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_learner_pi_cvplus.Rd b/man/mlr_pipeops_learner_pi_cvplus.Rd index 188718a80..9f2115c61 100644 --- a/man/mlr_pipeops_learner_pi_cvplus.Rd +++ b/man/mlr_pipeops_learner_pi_cvplus.Rd @@ -29,9 +29,10 @@ out-of-fold residuals and out-of-fold predictions. This argument is always cloned; to access the \code{\link[mlr3:Learner]{Learner}} inside \code{PipeOpLearnerPICVPlus} by-reference, use \verb{$learner}.\cr \item \code{id} :: \code{character(1)} Identifier of the resulting object, internally defaulting to the \code{id} of the \code{\link[mlr3:Learner]{Learner}} being wrapped. +Deprecated, will be removed in the future. \item \code{param_vals} :: named \code{list}\cr -List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. -Default is \code{list()}. +List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default is \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_learner_quantiles.Rd b/man/mlr_pipeops_learner_quantiles.Rd index 88244f271..d38d8e37f 100644 --- a/man/mlr_pipeops_learner_quantiles.Rd +++ b/man/mlr_pipeops_learner_quantiles.Rd @@ -28,8 +28,10 @@ The \code{\link[mlr3:Learner]{Learner}} has to be a \code{\link[mlr3:LearnerRegr This argument is always cloned; to access the \code{\link[mlr3:Learner]{Learner}} inside \code{PipeOpLearnerQuantiles} by-reference, use \verb{$learner}. \item \code{id} :: \code{character(1)} Identifier of the resulting object, internally defaulting to the \code{id} of the \code{\link[mlr3:Learner]{Learner}} being wrapped. +Deprecated, will be removed in the future. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_missind.Rd b/man/mlr_pipeops_missind.Rd index 578044460..aeded394d 100644 --- a/man/mlr_pipeops_missind.Rd +++ b/man/mlr_pipeops_missind.Rd @@ -22,8 +22,10 @@ values in factorial columns are often indicated by out-of-range imputation (\cod \itemize{ \item \code{id} :: \code{character(1)} Identifier of the resulting object, defaulting to \code{"missind"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_modelmatrix.Rd b/man/mlr_pipeops_modelmatrix.Rd index f13f6f6e0..abec8ff3b 100644 --- a/man/mlr_pipeops_modelmatrix.Rd +++ b/man/mlr_pipeops_modelmatrix.Rd @@ -18,8 +18,10 @@ Transforms columns using a given \code{formula} using the \code{\link[stats:mode \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"modelmatrix"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_multiplicityexply.Rd b/man/mlr_pipeops_multiplicityexply.Rd index 66f591560..cd7515c7a 100644 --- a/man/mlr_pipeops_multiplicityexply.Rd +++ b/man/mlr_pipeops_multiplicityexply.Rd @@ -27,9 +27,10 @@ may change. Determines the number of output channels. \item \code{id} :: \code{character(1)}\cr Identifier of the resulting object, default \code{"multiplicityexply"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr -List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise -be set during construction. Default \code{list()}. +List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_multiplicityimply.Rd b/man/mlr_pipeops_multiplicityimply.Rd index 2ac6cce80..cddcc599e 100644 --- a/man/mlr_pipeops_multiplicityimply.Rd +++ b/man/mlr_pipeops_multiplicityimply.Rd @@ -30,9 +30,10 @@ of inputs. If \code{innum} is a \code{character} vector, the number of input cha \code{innum}. \item \code{id} :: \code{character(1)}\cr Identifier of the resulting object, default \code{"multiplicityimply"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr -List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise -be set during construction. Default \code{list()}. +List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_mutate.Rd b/man/mlr_pipeops_mutate.Rd index 8adb36b74..6ea333ab5 100644 --- a/man/mlr_pipeops_mutate.Rd +++ b/man/mlr_pipeops_mutate.Rd @@ -19,8 +19,10 @@ This can add new features, or can change existing features. \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"mutate"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_nearmiss.Rd b/man/mlr_pipeops_nearmiss.Rd index 8d4898a66..75d648f76 100644 --- a/man/mlr_pipeops_nearmiss.Rd +++ b/man/mlr_pipeops_nearmiss.Rd @@ -26,8 +26,10 @@ See \code{\link[themis:nearmiss]{themis::nearmiss}} for details. \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"nearmiss"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_nmf.Rd b/man/mlr_pipeops_nmf.Rd index c7b29b64c..a85447685 100644 --- a/man/mlr_pipeops_nmf.Rd +++ b/man/mlr_pipeops_nmf.Rd @@ -19,9 +19,10 @@ affects non-negative numerical features. See \code{\link[NMF:nmf]{nmf()}} for de \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"nmf"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr -List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise -be set during construction. Default \code{list()}. +List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_nop.Rd b/man/mlr_pipeops_nop.Rd index 7526ba53d..6b5380242 100644 --- a/man/mlr_pipeops_nop.Rd +++ b/man/mlr_pipeops_nop.Rd @@ -19,8 +19,10 @@ Can be useful during \code{\link{Graph}} construction using the \code{\link{\%>> \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"nop"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_ovrsplit.Rd b/man/mlr_pipeops_ovrsplit.Rd index 062e086f8..a0007cb7b 100644 --- a/man/mlr_pipeops_ovrsplit.Rd +++ b/man/mlr_pipeops_ovrsplit.Rd @@ -30,8 +30,10 @@ may change. \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of the resulting object, default \code{"ovrsplit"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_ovrunite.Rd b/man/mlr_pipeops_ovrunite.Rd index 3ce033902..eea76cdc0 100644 --- a/man/mlr_pipeops_ovrunite.Rd +++ b/man/mlr_pipeops_ovrunite.Rd @@ -33,8 +33,10 @@ may change. \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of the resulting object, default \code{"ovrunite"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_pca.Rd b/man/mlr_pipeops_pca.Rd index df34f6be2..737b693e8 100644 --- a/man/mlr_pipeops_pca.Rd +++ b/man/mlr_pipeops_pca.Rd @@ -19,8 +19,10 @@ See \code{\link[stats:prcomp]{stats::prcomp()}} for details. \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"pca"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_proxy.Rd b/man/mlr_pipeops_proxy.Rd index d1b92cf65..8a4792e82 100644 --- a/man/mlr_pipeops_proxy.Rd +++ b/man/mlr_pipeops_proxy.Rd @@ -23,9 +23,10 @@ The \code{content} hyperparameter can be changed during tuning, this is useful a Determines the number of output channels. \item \code{id} :: \code{character(1)}\cr Identifier of resulting object. See \verb{$id} slot of \code{\link{PipeOp}}. +Deprecated, will be removed in the future. \item \code{param_vals} :: named \code{list}\cr -List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise -be set during construction. Default \code{list()}. +List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_quantilebin.Rd b/man/mlr_pipeops_quantilebin.Rd index 3570d0503..dd8a9bfb6 100644 --- a/man/mlr_pipeops_quantilebin.Rd +++ b/man/mlr_pipeops_quantilebin.Rd @@ -18,8 +18,10 @@ Splits numeric features into quantile bins. \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"quantilebin"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_randomprojection.Rd b/man/mlr_pipeops_randomprojection.Rd index 486c91d5f..7f8ceff1a 100644 --- a/man/mlr_pipeops_randomprojection.Rd +++ b/man/mlr_pipeops_randomprojection.Rd @@ -24,6 +24,7 @@ if missing values can be expected. \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"randomprojection"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. diff --git a/man/mlr_pipeops_randomresponse.Rd b/man/mlr_pipeops_randomresponse.Rd index e3331d268..300cb6660 100644 --- a/man/mlr_pipeops_randomresponse.Rd +++ b/man/mlr_pipeops_randomresponse.Rd @@ -28,9 +28,10 @@ deviation (sampling is done observation-wise). \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of the resulting object, default \code{"randomresponse"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr -List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise -be set during construction. Default \code{list()}. +List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. \item packages :: \code{character}\cr Set of all required packages for the \code{private$.predict()} methods related to the \code{rdistfun} parameter. Default is \code{character(0)}. diff --git a/man/mlr_pipeops_regravg.Rd b/man/mlr_pipeops_regravg.Rd index 76fac8eb0..c4d2fa6bd 100644 --- a/man/mlr_pipeops_regravg.Rd +++ b/man/mlr_pipeops_regravg.Rd @@ -33,8 +33,10 @@ If \code{TRUE}, the input is a \code{\link{Multiplicity}} collecting channel. Th Default is \code{FALSE}. \item \code{id} :: \code{character(1)} Identifier of the resulting object, default \code{"regravg"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_removeconstants.Rd b/man/mlr_pipeops_removeconstants.Rd index 3da03d8ce..b92fc59c5 100644 --- a/man/mlr_pipeops_removeconstants.Rd +++ b/man/mlr_pipeops_removeconstants.Rd @@ -21,8 +21,10 @@ Missing values can be ignored or treated as a regular value distinct from non-mi \itemize{ \item \code{id} :: \code{character(1)} Identifier of the resulting object, defaulting to \code{"removeconstants"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_renamecolumns.Rd b/man/mlr_pipeops_renamecolumns.Rd index 131433937..ad7553f1b 100644 --- a/man/mlr_pipeops_renamecolumns.Rd +++ b/man/mlr_pipeops_renamecolumns.Rd @@ -19,8 +19,10 @@ Uses the \verb{$rename()} mutator of the \code{\link[mlr3:Task]{Task}}. \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"renamecolumns"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_replicate.Rd b/man/mlr_pipeops_replicate.Rd index 9d015566d..bc307e938 100644 --- a/man/mlr_pipeops_replicate.Rd +++ b/man/mlr_pipeops_replicate.Rd @@ -22,9 +22,10 @@ may change. \itemize{ \item \code{id} :: \code{character(1)} Identifier of the resulting object, default \code{"replicate"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr -List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise -be set during construction. Default \code{list()}. +List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_rowapply.Rd b/man/mlr_pipeops_rowapply.Rd index 62226792b..39a4da4d2 100644 --- a/man/mlr_pipeops_rowapply.Rd +++ b/man/mlr_pipeops_rowapply.Rd @@ -19,8 +19,10 @@ Applies a function to each row of a task. Use the \code{affect_columns} paramete \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"rowapply"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_scale.Rd b/man/mlr_pipeops_scale.Rd index 3bf30b521..fd31bc896 100644 --- a/man/mlr_pipeops_scale.Rd +++ b/man/mlr_pipeops_scale.Rd @@ -22,8 +22,10 @@ is \code{TRUE}, this corresponds to the \code{\link[stats:sd]{sd()}}. \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"scale"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_scalemaxabs.Rd b/man/mlr_pipeops_scalemaxabs.Rd index 011f75107..d0ee93268 100644 --- a/man/mlr_pipeops_scalemaxabs.Rd +++ b/man/mlr_pipeops_scalemaxabs.Rd @@ -20,8 +20,10 @@ are not scaled. \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"scalemaxabs"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_scalerange.Rd b/man/mlr_pipeops_scalerange.Rd index 48af7d223..5aa957e04 100644 --- a/man/mlr_pipeops_scalerange.Rd +++ b/man/mlr_pipeops_scalerange.Rd @@ -22,8 +22,10 @@ prediction. \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"scalerange"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_select.Rd b/man/mlr_pipeops_select.Rd index 7d678830b..19aa3c0d9 100644 --- a/man/mlr_pipeops_select.Rd +++ b/man/mlr_pipeops_select.Rd @@ -20,8 +20,10 @@ See \code{\link{Selector}} for selectors that are provided and how to write cust \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"select"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_smote.Rd b/man/mlr_pipeops_smote.Rd index 0bfd310db..736fda8ad 100644 --- a/man/mlr_pipeops_smote.Rd +++ b/man/mlr_pipeops_smote.Rd @@ -20,8 +20,10 @@ It can only be applied to tasks with purely numeric features. See \code{\link[sm \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"smote"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_smotenc.Rd b/man/mlr_pipeops_smotenc.Rd index 5a231bb2a..f9d262d99 100644 --- a/man/mlr_pipeops_smotenc.Rd +++ b/man/mlr_pipeops_smotenc.Rd @@ -31,8 +31,10 @@ See \code{\link[themis:smotenc]{themis::smotenc}} for details. \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"smotenc"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_spatialsign.Rd b/man/mlr_pipeops_spatialsign.Rd index efad79930..5f3b82f25 100644 --- a/man/mlr_pipeops_spatialsign.Rd +++ b/man/mlr_pipeops_spatialsign.Rd @@ -18,8 +18,10 @@ Normalizes the data row-wise. This is a natural generalization of the "sign" fun \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"spatialsign"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_subsample.Rd b/man/mlr_pipeops_subsample.Rd index 6cd121c46..bf00034f5 100644 --- a/man/mlr_pipeops_subsample.Rd +++ b/man/mlr_pipeops_subsample.Rd @@ -22,8 +22,10 @@ negligible cost of predictive performance. \itemize{ \item \code{id} :: \code{character(1)} Identifier of the resulting object, default \code{"subsample"} +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_targetinvert.Rd b/man/mlr_pipeops_targetinvert.Rd index 33f65c50c..c0e8e8453 100644 --- a/man/mlr_pipeops_targetinvert.Rd +++ b/man/mlr_pipeops_targetinvert.Rd @@ -23,8 +23,10 @@ the \code{"prediction"} as a single element, and should return a \code{list} wit \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"targetinvert"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_targetmutate.Rd b/man/mlr_pipeops_targetmutate.Rd index b348d1ce3..49e2f5422 100644 --- a/man/mlr_pipeops_targetmutate.Rd +++ b/man/mlr_pipeops_targetmutate.Rd @@ -19,9 +19,10 @@ An inverter-function that undoes the transformation during prediction must also \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"targetmutate"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr -List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise -be set during construction. Default \code{list()}. +List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. \item \code{new_task_type} :: \code{character(1)} | \code{NULL}\cr The task type to which the output is converted, must be one of \code{mlr_reflections$task_types$type}. Defaults to \code{NULL}: no change in task type. diff --git a/man/mlr_pipeops_targettrafoscalerange.Rd b/man/mlr_pipeops_targettrafoscalerange.Rd index 8400551c5..7295982d5 100644 --- a/man/mlr_pipeops_targettrafoscalerange.Rd +++ b/man/mlr_pipeops_targettrafoscalerange.Rd @@ -22,9 +22,10 @@ prediction. \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"targettrafoscalerange"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr -List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise -be set during construction. Default \code{list()}. +List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_textvectorizer.Rd b/man/mlr_pipeops_textvectorizer.Rd index d40503694..625005b4e 100644 --- a/man/mlr_pipeops_textvectorizer.Rd +++ b/man/mlr_pipeops_textvectorizer.Rd @@ -49,8 +49,10 @@ The \code{\link{PipeOp}} works as follows: \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"textvectorizer"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_threshold.Rd b/man/mlr_pipeops_threshold.Rd index d8aa2fa5c..86e015101 100644 --- a/man/mlr_pipeops_threshold.Rd +++ b/man/mlr_pipeops_threshold.Rd @@ -20,9 +20,10 @@ Internally calls \code{PredictionClassif$set_threshold}. \itemize{ \item \code{id} :: \code{character(1)} Identifier of the resulting object, default \code{"threshold"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. -Defaults to \code{numeric(0)}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_tomek.Rd b/man/mlr_pipeops_tomek.Rd index 7a3bee4bd..84eca511b 100644 --- a/man/mlr_pipeops_tomek.Rd +++ b/man/mlr_pipeops_tomek.Rd @@ -26,8 +26,10 @@ See \code{\link[themis:tomek]{themis::tomek}} for details. \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"tomek"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_tunethreshold.Rd b/man/mlr_pipeops_tunethreshold.Rd index a8f935e3a..685f28972 100644 --- a/man/mlr_pipeops_tunethreshold.Rd +++ b/man/mlr_pipeops_tunethreshold.Rd @@ -19,7 +19,7 @@ Returns a single \code{\link[mlr3:PredictionClassif]{PredictionClassif}}. This PipeOp should be used in conjunction with \code{\link{PipeOpLearnerCV}} in order to optimize thresholds of cross-validated predictions. In order to optimize thresholds without cross-validation, use \code{\link{PipeOpLearnerCV}} -in conjunction with \code{\link[mlr3:ResamplingInsample]{ResamplingInsample}}. +in conjunction with \code{\link[mlr3:mlr_resamplings_insample]{ResamplingInsample}}. } \section{Construction}{ @@ -29,9 +29,10 @@ in conjunction with \code{\link[mlr3:ResamplingInsample]{ResamplingInsample}}. \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object. Default: "tunethreshold". +Deprecated, will be removed in the future. \item \code{param_vals} :: named \code{list}\cr -List of hyperparameter settings, overwriting the hyperparameter settings -that would otherwise be set during construction. Default \code{list()}. +List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_unbranch.Rd b/man/mlr_pipeops_unbranch.Rd index f79719aed..346468a2d 100644 --- a/man/mlr_pipeops_unbranch.Rd +++ b/man/mlr_pipeops_unbranch.Rd @@ -28,8 +28,10 @@ However, it is not necessary to have matching names and the \emph{vararg} option is always viable. \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"unbranch"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_updatetarget.Rd b/man/mlr_pipeops_updatetarget.Rd index 263b41ff3..d0c61edfa 100644 --- a/man/mlr_pipeops_updatetarget.Rd +++ b/man/mlr_pipeops_updatetarget.Rd @@ -37,6 +37,7 @@ Identifier of resulting object. See \verb{$id} slot of \code{\link{PipeOp}}. List of hyperparameter settings, overwriting the hyperparameter settings given in \code{param_set}. The subclass should have its own \code{param_vals} parameter and pass it on to \code{super$initialize()}. Default \code{list()}. +Deprecated, will be removed in the future. } } diff --git a/man/mlr_pipeops_vtreat.Rd b/man/mlr_pipeops_vtreat.Rd index 81514f09d..aa95c4cb4 100644 --- a/man/mlr_pipeops_vtreat.Rd +++ b/man/mlr_pipeops_vtreat.Rd @@ -23,8 +23,10 @@ Internally, \code{PipeOpVtreat} follows the fit/prepare interface of vtreat, i.e \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"vtreat"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/mlr_pipeops_yeojohnson.Rd b/man/mlr_pipeops_yeojohnson.Rd index f1823e343..ba7c3ee5f 100644 --- a/man/mlr_pipeops_yeojohnson.Rd +++ b/man/mlr_pipeops_yeojohnson.Rd @@ -20,8 +20,10 @@ See \code{\link[bestNormalize:yeojohnson]{bestNormalize::yeojohnson()}} for deta \itemize{ \item \code{id} :: \code{character(1)}\cr Identifier of resulting object, default \code{"yeojohnson"}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set a custom ID on construction. \item \code{param_vals} :: named \code{list}\cr List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default \code{list()}. +Deprecated, will be removed in the future. Use the \code{\link[=po]{po()}} syntax to set hyperparameters on construction. } } diff --git a/man/set_validate.GraphLearner.Rd b/man/set_validate.GraphLearner.Rd index 95ef2a2b8..9d87b5866 100644 --- a/man/set_validate.GraphLearner.Rd +++ b/man/set_validate.GraphLearner.Rd @@ -27,12 +27,12 @@ This parameter is ignored when \code{validate} is set to \code{NULL}. By default, validation is enabled for the final \code{PipeOp} in the \code{Graph}.} \item{args_all}{(\code{list()})\cr -Rarely needed. A named list of parameter values that are passed to all subsequet \code{\link[mlr3:set_validate]{set_validate()}} calls on the individual +Rarely needed. A named list of parameter values that are passed to all subsequet \code{\link[mlr3:mlr_sugar]{set_validate()}} calls on the individual \code{PipeOp}s.} \item{args}{(named \code{list()})\cr Rarely needed. -A named list of lists, specifying additional argments to be passed to \code{\link[mlr3:set_validate]{set_validate()}} when calling it on the individual +A named list of lists, specifying additional argments to be passed to \code{\link[mlr3:mlr_sugar]{set_validate()}} when calling it on the individual \code{PipeOp}s.} \item{...}{(any)\cr From 7a08622e13787ebd474e3876da1869bed2a26f39 Mon Sep 17 00:00:00 2001 From: mb706 Date: Thu, 14 Aug 2025 23:33:27 +0200 Subject: [PATCH 18/31] work around static checker --- R/PipeOp.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/PipeOp.R b/R/PipeOp.R index 52a003495..27b433392 100644 --- a/R/PipeOp.R +++ b/R/PipeOp.R @@ -277,7 +277,7 @@ PipeOp = R6Class("PipeOp", if (identical(class(self), sf$classes)) { newcall = match.call(sys.function(found), sc[[found]], envir = sf) passes_param_vals = !is.null(newcall$param_vals) - dots = evalq(list(...), envir = sf) + dots = (function(...) evalq(list(...), envir = sf))() # function(...) is here to pacify R CMD check static checks unnamed_dots = dots[is.na(names2(dots))] passes_id = length(unnamed_dots) && !is.null(newcall$id) && identical(newcall$id, unnamed_dots[[1]]) if (passes_param_vals || passes_id) { From 0bfd777ebe0c8762a762ccd65e0314bf5185efd5 Mon Sep 17 00:00:00 2001 From: mb706 Date: Fri, 15 Aug 2025 00:06:33 +0200 Subject: [PATCH 19/31] fixes --- tests/testthat/test_mlr_graphs_targettrafo.R | 3 +-- tests/testthat/test_pipeop_colroles.R | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/testthat/test_mlr_graphs_targettrafo.R b/tests/testthat/test_mlr_graphs_targettrafo.R index 9ddd32f95..53c5bbdcb 100644 --- a/tests/testthat/test_mlr_graphs_targettrafo.R +++ b/tests/testthat/test_mlr_graphs_targettrafo.R @@ -11,10 +11,9 @@ test_that("Target Trafo Pipeline", { expect_true(length(tt$pipeops) == 1 + 1 + 1) g = Graph$new() - g$add_pipeop(PipeOpTargetMutate$new(param_vals = list( + g$add_pipeop(PipeOpTargetMutate$new()$configure( trafo = function(x) log(x, base = 2), inverter = function(x) list(response = 2 ^ x$response)) - ) ) g$add_pipeop(LearnerRegrRpart$new()) g$add_pipeop(PipeOpTargetInvert$new()) diff --git a/tests/testthat/test_pipeop_colroles.R b/tests/testthat/test_pipeop_colroles.R index 53b9998fd..490a8ee13 100644 --- a/tests/testthat/test_pipeop_colroles.R +++ b/tests/testthat/test_pipeop_colroles.R @@ -93,7 +93,7 @@ test_that("PipeOpColRoles - new_role_direct works", { task$col_roles$group = "Species" op = po("colroles", new_role_direct = list( - name = "rn", order = c("Petal.Length", "Sepal.Length"), feature = character(0), group = NULL)) + name = "rn", order = c("Petal.Length", "Sepal.Length"), feature = character(0), group = NULL) ) train_out = train_pipeop(op, inputs = list(task))[[1L]] From 89ab5daec513cab31248be8a90cf52ead2534121 Mon Sep 17 00:00:00 2001 From: mb706 Date: Fri, 15 Aug 2025 00:26:42 +0200 Subject: [PATCH 20/31] more experiments --- R/PipeOp.R | 2 +- tests/testthat/setup.R | 2 +- tests/testthat/test_dictionary.R | 17 ++++++++++++++--- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/R/PipeOp.R b/R/PipeOp.R index 27b433392..1ed005cb0 100644 --- a/R/PipeOp.R +++ b/R/PipeOp.R @@ -281,7 +281,7 @@ PipeOp = R6Class("PipeOp", unnamed_dots = dots[is.na(names2(dots))] passes_id = length(unnamed_dots) && !is.null(newcall$id) && identical(newcall$id, unnamed_dots[[1]]) if (passes_param_vals || passes_id) { - warning("passing param_vals, and unnamed id, for PipeOp construction directly is deprecated and will be removed in the future. + deprecated_component("passing param_vals, and unnamed id, for PipeOp construction directly is deprecated and will be removed in the future. Use the po()-syntax to set these, instead: po(\"pipeop\", \"newid\", param_vals = list(a = 1)) --> po(\"pipeop\", id = \"newid\", a = 1)") } diff --git a/tests/testthat/setup.R b/tests/testthat/setup.R index 24d93773b..221bc4817 100644 --- a/tests/testthat/setup.R +++ b/tests/testthat/setup.R @@ -7,7 +7,7 @@ options(warnPartialMatchArgs = TRUE) options(warnPartialMatchAttr = TRUE) options(warnPartialMatchDollar = TRUE) options(mlr3.warn_deprecated = FALSE) # avoid triggers when expect_identical() accesses deprecated fields - +options(mlr3.on_deprecated = "error") # simulate packages that extend existing task type x = mlr3::mlr_reflections diff --git a/tests/testthat/test_dictionary.R b/tests/testthat/test_dictionary.R index 91f3293ca..b904ffd18 100644 --- a/tests/testthat/test_dictionary.R +++ b/tests/testthat/test_dictionary.R @@ -101,7 +101,11 @@ test_that("Dictionary contains all PipeOps", { } # check that mlr_pipeops$get() gives the same object as PipeOpXXX$new() does - other_obj = do.call(mlr_pipeops$get, c(list(dictname), args)) + other_obj = do.call(mlr_pipeops$get, c(list(dictname), args[names(args) != "param_vals"])) + if ("param_vals" %in% names(args)) { + other_obj$param_set$set_values(.values = args$param_vals) + } + expect_equal(other_obj, test_obj, info = paste(dictname, "$new test")) if (!dictname %in% pval_unhashable) { expect_equal(other_obj$hash, test_obj$hash, info = paste(dictname, "$new test")) @@ -110,12 +114,19 @@ test_that("Dictionary contains all PipeOps", { # check that ID can be changed args$id = "TESTID" - other_obj = do.call(mlr_pipeops$get, c(list(dictname), args)) + other_obj = do.call(mlr_pipeops$get, c(list(dictname), args[names(args) != "param_vals"])) + if ("param_vals" %in% names(args)) { + other_obj$param_set$set_values(.values = args$param_vals) + } + expect_false(isTRUE(all.equal(other_obj, test_obj)), info = paste(dictname, "$new id test")) expect_false(isTRUE(all.equal(other_obj$hash, test_obj$hash)), info = paste(dictname, "$new id test")) expect_false(isTRUE(all.equal(other_obj$phash, test_obj$phash)), info = paste(dictname, "$new id test")) test_obj$id = "TESTID" - other_obj = inflate(do.call(mlr_pipeops$get, c(list(dictname), args))) + other_obj = inflate(do.call(mlr_pipeops$get, c(list(dictname), args[names(args) != "param_vals"]))) + if ("param_vals" %in% names(args)) { + other_obj$param_set$set_values(.values = args$param_vals) + } expect_equal(other_obj, test_obj, info = paste(dictname, "$new id test 2")) if (!dictname %in% pval_unhashable) { From bbd93106c39d5d81b5ea0cc6f003d34424bf45bc Mon Sep 17 00:00:00 2001 From: mb706 Date: Fri, 15 Aug 2025 11:26:27 +0200 Subject: [PATCH 21/31] next try --- tests/testthat/setup.R | 4 ++-- tests/testthat/test_pipeop_learnerpicvplus.R | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/testthat/setup.R b/tests/testthat/setup.R index 221bc4817..746abfe3e 100644 --- a/tests/testthat/setup.R +++ b/tests/testthat/setup.R @@ -17,8 +17,8 @@ x$task_types = data.table::setkeyv(rbind(x$task_types, x$task_types["classif", m mlr3::mlr_tasks$add("boston_housing_classic", function(id = "boston_housing_classic") { b = mlr3::as_data_backend(mlr3misc::load_dataset("BostonHousing2", "mlbench")) - task = mlr3::TaskRegr$new(id, b, target = "medv", label = "Boston Housing Prices (target leakage, for mlr3pipelines tests only)") - b$hash = "mlr3pipelines::mlr_tasks_boston_housing_classic" + task = mlr3::TaskRegr$new(id, b, target = "medv") + task$override_info(man = "mlbench::BostonHousing2", hash = "mlr3::mlr_tasks_boston_housing_classic") task }) diff --git a/tests/testthat/test_pipeop_learnerpicvplus.R b/tests/testthat/test_pipeop_learnerpicvplus.R index e57fda58a..17c12d9ec 100644 --- a/tests/testthat/test_pipeop_learnerpicvplus.R +++ b/tests/testthat/test_pipeop_learnerpicvplus.R @@ -124,7 +124,7 @@ test_that("PipeOpLearnerPICVPlus - integration with larger graph", { test_that("marshal", { lrn = lrn("regr.debug") - lrn$properties = c(lrn$properties, "marshal") + lrn$.__enclos_env__$private$.properties = c(lrn$properties, "marshal") task = tsk("mtcars") po = PipeOpLearnerPICVPlus$new(lrn) @@ -144,7 +144,7 @@ test_that("marshal", { test_that("marshal multiplicity", { lrn = lrn("regr.debug") - lrn$properties = c(lrn$properties, "marshal") + lrn$.__enclos_env__$private$.properties = c(lrn$properties, "marshal") po = PipeOpLearnerPICVPlus$new(lrn) task1 = mlr_tasks$get("mtcars") @@ -163,7 +163,7 @@ test_that("marshal multiplicity", { test_that("state class and multiplicity", { skip_on_cran() lrn = lrn("regr.debug") - lrn$properties = c(lrn$properties, "marshal") + lrn$.__enclos_env__$private$.properties = c(lrn$properties, "marshal") po = PipeOpLearnerPICVPlus$new(lrn) task1 = mlr_tasks$get("mtcars") From 620ea9d85d2c69903da86bf25a695d428fbf8ca5 Mon Sep 17 00:00:00 2001 From: mb706 Date: Fri, 15 Aug 2025 11:46:17 +0200 Subject: [PATCH 22/31] syntax fix --- tests/testthat/test_pipeop_datefeatures.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test_pipeop_datefeatures.R b/tests/testthat/test_pipeop_datefeatures.R index 72a5d6382..4705b65c0 100644 --- a/tests/testthat/test_pipeop_datefeatures.R +++ b/tests/testthat/test_pipeop_datefeatures.R @@ -39,7 +39,7 @@ test_that("PipeOpDateFeatures - unaltered if no features specified", { task = TaskClassif$new("iris_date", backend = dat, target = "Species") po = po("datefeatures", cyclic = TRUE, year = FALSE, month = FALSE, week_of_year = FALSE, day_of_year = FALSE, day_of_month = FALSE, - day_of_week = FALSE, hour = FALSE, minute = FALSE, second = FALSE, is_day = FALSE)) + day_of_week = FALSE, hour = FALSE, minute = FALSE, second = FALSE, is_day = FALSE) train_pipeop(po, inputs = list(task)) expect_identical(po$state$intasklayout, po$state$outtasklayout) }) From 2d2cc6226287930b9e3b02bdd6a6fa6d8962ce90 Mon Sep 17 00:00:00 2001 From: mb706 Date: Fri, 15 Aug 2025 11:55:08 +0200 Subject: [PATCH 23/31] use adjusted mlr3learners --- DESCRIPTION | 1 + 1 file changed, 1 insertion(+) diff --git a/DESCRIPTION b/DESCRIPTION index 6366b5caf..5e3ac6475 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -104,6 +104,7 @@ Suggests: themis Remotes: mlr-org/mlr3misc@common_baseclass, + mlr-org/mlr3learners@common_baseclass, mlr-org/mlr3@common_baseclass ByteCompile: true Encoding: UTF-8 From 8b9cdd0dd53e566bb601020dc6ee8f012cb46885 Mon Sep 17 00:00:00 2001 From: mb706 Date: Fri, 15 Aug 2025 13:04:31 +0200 Subject: [PATCH 24/31] read-only properties --- tests/testthat/test_GraphLearner.R | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/testthat/test_GraphLearner.R b/tests/testthat/test_GraphLearner.R index 1ad0e699d..23a01f8ff 100644 --- a/tests/testthat/test_GraphLearner.R +++ b/tests/testthat/test_GraphLearner.R @@ -14,7 +14,7 @@ test_that("basic graphlearner tests", { glrn$use_weights = "error" # also need to update use_weights now } expect_true(run_experiment(task, glrn)$ok) - glrn$properties = c(glrn$properties, "weights") + glrn$.__enclos_env__$private$.properties = c(glrn$properties, "weights") glrn = GraphLearner$new(gr) expect_learner(glrn) @@ -1099,7 +1099,7 @@ DebugBasic = R6Class("DebugBasic", inherit = LearnerClassifDebug, public = list( initialize = function(...) { super$initialize(...) - self$properties = setdiff(self$properties, c("importance", "selected_features", "loglik", "oob_error")) + private$.properties = setdiff(self$properties, c("importance", "selected_features", "loglik", "oob_error")) }, importance = function() { return(sapply(self$state$feature_names, function(i) 1)) @@ -1112,7 +1112,7 @@ test_that("GraphLearner Importance", { public = list( initialize = function(...) { super$initialize(...) - self$properties = c(setdiff(self$properties, c("importance", "selected_features", "loglik", "oob_error")), "importance") + private$.properties = c(setdiff(self$properties, c("importance", "selected_features", "loglik", "oob_error")), "importance") }, importance = function() { return(sapply(self$state$feature_names, function(i) 1)) @@ -1182,7 +1182,7 @@ test_that("GraphLearner Selected Features", { public = list( initialize = function(...) { super$initialize(...) - self$properties = c(setdiff(self$properties, c("importance", "selected_features", "loglik", "oob_error")), "selected_features") + private$.properties = c(setdiff(self$properties, c("importance", "selected_features", "loglik", "oob_error")), "selected_features") }, selected_features = function() { return(self$state$feature_names[[1]]) @@ -1287,7 +1287,7 @@ test_that("GraphLearner other properties", { public = list( initialize = function(...) { super$initialize(...) - self$properties = c( + private$.properties = c( setdiff(self$properties, c("importance", "selected_features", "loglik", "oob_error")), "loglik", "oob_error") }, From d40bde997fc4d2d6c1fdd0c9559a1e7a90683785 Mon Sep 17 00:00:00 2001 From: mb706 Date: Fri, 15 Aug 2025 13:05:36 +0200 Subject: [PATCH 25/31] man deprecated --- R/LearnerAvg.R | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/R/LearnerAvg.R b/R/LearnerAvg.R index dccd6da60..1e3eb1041 100644 --- a/R/LearnerAvg.R +++ b/R/LearnerAvg.R @@ -72,8 +72,7 @@ LearnerClassifAvg = R6Class("LearnerClassifAvg", inherit = LearnerClassif, param_set = ps, predict_types = c("response", "prob"), feature_types = c("integer", "numeric", "factor"), - properties = c("twoclass", "multiclass"), - man = "mlr3pipelines::LearnerClassifAvg" + properties = c("twoclass", "multiclass") ) }, prepare_data = function(task) { @@ -145,8 +144,7 @@ LearnerRegrAvg = R6Class("LearnerRegrAvg", inherit = LearnerRegr, id = id, param_set = ps, predict_types = "response", - feature_types = c("integer", "numeric"), - man = "mlr3pipelines::LearnerRegrAvg" + feature_types = c("integer", "numeric") ) }, prepare_data = function(task) { From 81e91d1fa1a5c094445dd4cb8a83cf3b2afd9635 Mon Sep 17 00:00:00 2001 From: mb706 Date: Fri, 15 Aug 2025 13:12:31 +0200 Subject: [PATCH 26/31] some progress --- tests/testthat/test_mlr_graphs_robustify.R | 4 +- tests/testthat/test_pipeop_colroles.R | 42 +++++++++---------- tests/testthat/test_pipeop_datefeatures.R | 10 ++--- tests/testthat/test_pipeop_learnerquantiles.R | 6 +-- 4 files changed, 31 insertions(+), 31 deletions(-) diff --git a/tests/testthat/test_mlr_graphs_robustify.R b/tests/testthat/test_mlr_graphs_robustify.R index f4b07a7ab..18bca27eb 100644 --- a/tests/testthat/test_mlr_graphs_robustify.R +++ b/tests/testthat/test_mlr_graphs_robustify.R @@ -32,7 +32,7 @@ test_that("Robustify Pipeline", { expect_true("encode" %in% names(p$pipeops)) # missing fcts, assuming rpart can not do missings - lrn$properties = c("multiclass", "twoclass") + lrn$.__enclos_env__$private$.properties = c("multiclass", "twoclass") dt = data.table("fct2" = factor(rep_len(c(letters[1:3], NA), tsk$nrow))) tsk$cbind(dt) p = ppl("robustify", task = tsk, learner = lrn) %>>% po(lrn) @@ -108,7 +108,7 @@ test_that("Robustify Pipeline Impute Missings", { lmissings = lrn("classif.rpart") lnomissings = lrn("classif.rpart") - lnomissings$properties = setdiff(lnomissings$properties, "missings") + lnomissings$.__enclos_env__$private$.properties = setdiff(lnomissings$properties, "missings") micols = tmissings$missings()[tmissings$missings() != 0] names(micols) = paste0("missing_", names(micols)) diff --git a/tests/testthat/test_pipeop_colroles.R b/tests/testthat/test_pipeop_colroles.R index 490a8ee13..5ccd79734 100644 --- a/tests/testthat/test_pipeop_colroles.R +++ b/tests/testthat/test_pipeop_colroles.R @@ -8,27 +8,27 @@ test_that("PipeOpColRoles - basic properties", { test_that("PipeOpColRoles - assertions on params work", { - expect_error(PipeOpColRoles$new(param_vals = list(new_role = "wrong")), regexp = "list") - expect_error(PipeOpColRoles$new(param_vals = list(new_role = list(a = "wrong", b = NA))), regexp = "character,null") - expect_no_error(PipeOpColRoles$new(param_vals = list(new_role = list(a = NULL)))) - expect_error(PipeOpColRoles$new(param_vals = list(new_role = list(a = "wrong"))), regexp = "subset") - expect_error(PipeOpColRoles$new(param_vals = list(new_role = list(a = "target"))), regexp = "subset") - - expect_error(PipeOpColRoles$new(param_vals = list(new_role = list(a = "group", b = "group"))), regexp = "up to one column per role") - expect_error(PipeOpColRoles$new(param_vals = list(new_role = list(a = "weight", b = "weight"))), regexp = "up to one column per role") - expect_error(PipeOpColRoles$new(param_vals = list(new_role = list(a = "name", b = "name"))), regexp = "up to one column per role") - expect_error(PipeOpColRoles$new(param_vals = list(new_role = list(a = c("group", "name"), b = c("group", "name")))), regexp = "up to one column per role.*?\"group\", \"name\"") - - expect_error(PipeOpColRoles$new(param_vals = list(new_role_direct = "wrong")), regexp = "list") - expect_error(PipeOpColRoles$new(param_vals = list(new_role_direct = list(wrong = "x", feature = NA))), regexp = "character,null") - expect_no_error(PipeOpColRoles$new(param_vals = list(new_role = list(feature = NULL)))) - expect_error(PipeOpColRoles$new(param_vals = list(new_role_direct = list(wrong = "x"))), regexp = "subset") - expect_error(PipeOpColRoles$new(param_vals = list(new_role_direct = list(target = "y"))), regexp = "subset") - - expect_error(PipeOpColRoles$new(param_vals = list(new_role_direct = list(group = c("x", "y")))), regexp = "up to one column per role") - expect_error(PipeOpColRoles$new(param_vals = list(new_role_direct = list(weight = c("x", "y")))), regexp = "up to one column per role") - expect_error(PipeOpColRoles$new(param_vals = list(new_role_direct = list(name = c("x", "y")))), regexp = "up to one column per role") - expect_error(PipeOpColRoles$new(param_vals = list(new_role_direct = list(group = c("x", "y"), name = c("x", "y")))), regexp = "up to one column per role.*?\"group\", \"name\"") + expect_error(po("colroles", new_role = "wrong"), regexp = "list") + expect_error(po("colroles", new_role = list(a = "wrong", b = NA)), regexp = "character,null") + expect_no_error(po("colroles", new_role = list(a = NULL))) + expect_error(po("colroles", new_role = list(a = "wrong")), regexp = "subset") + expect_error(po("colroles", new_role = list(a = "target")), regexp = "subset") + + expect_error(po("colroles", new_role = list(a = "group", b = "group")), regexp = "up to one column per role") + expect_error(po("colroles", new_role = list(a = "weight", b = "weight")), regexp = "up to one column per role") + expect_error(po("colroles", new_role = list(a = "name", b = "name")), regexp = "up to one column per role") + expect_error(po("colroles", new_role = list(a = c("group", "name"), b = c("group", "name"))), regexp = "up to one column per role.*?\"group\", \"name\"") + + expect_error(po("colroles", new_role_direct = "wrong"), regexp = "list") + expect_error(po("colroles", new_role_direct = list(wrong = "x", feature = NA)), regexp = "character,null") + expect_no_error(po("colroles", new_role = list(feature = NULL))) + expect_error(po("colroles", new_role_direct = list(wrong = "x")), regexp = "subset") + expect_error(po("colroles", new_role_direct = list(target = "y")), regexp = "subset") + + expect_error(po("colroles", new_role_direct = list(group = c("x", "y"))), regexp = "up to one column per role") + expect_error(po("colroles", new_role_direct = list(weight = c("x", "y"))), regexp = "up to one column per role") + expect_error(po("colroles", new_role_direct = list(name = c("x", "y"))), regexp = "up to one column per role") + expect_error(po("colroles", new_role_direct = list(group = c("x", "y"), name = c("x", "y"))), regexp = "up to one column per role.*?\"group\", \"name\"") }) diff --git a/tests/testthat/test_pipeop_datefeatures.R b/tests/testthat/test_pipeop_datefeatures.R index 4705b65c0..ae6debaca 100644 --- a/tests/testthat/test_pipeop_datefeatures.R +++ b/tests/testthat/test_pipeop_datefeatures.R @@ -113,8 +113,8 @@ test_that("PipeOpDateFeatures - feature selection works", { dat$date = sample(seq(as.POSIXct("2020-01-31"), to = as.POSIXct("2020-03-01"), by = "sec"), size = 150L) task = TaskClassif$new("iris_date", backend = dat, target = "Species") - po = PipeOpDateFeatures$new(param_vals = list(cyclic = TRUE, year = FALSE, - second = FALSE)) + po = po("datefeatures", cyclic = TRUE, year = FALSE, + second = FALSE) expect_identical(train_pipeop(po, inputs = list(task))$output$feature_names, c("Petal.Length", "Petal.Width", "Sepal.Length", "Sepal.Width", paste0("date.", @@ -135,7 +135,7 @@ test_that("PipeOpDateFeatures - keep_date_var works", { dat$date = sample(seq(as.POSIXct("2020-01-31"), to = as.POSIXct("2020-03-01"), by = "sec"), size = 150L) task = TaskClassif$new("iris_date", backend = dat, target = "Species") - po = PipeOpDateFeatures$new(param_vals = list(keep_date_var = TRUE)) + po = po("datefeatures", keep_date_var = TRUE) expect_true("date" %in% train_pipeop(po, inputs = list(task))$output$feature_names) }) @@ -155,7 +155,7 @@ test_that("PipeOpDateFeatures - constant dates", { dat = iris dat$date = as.POSIXct("2020-01-31") task = TaskClassif$new("iris_date", backend = dat, target = "Species") - po = PipeOpDateFeatures$new(param_vals = list(cyclic = TRUE)) + po = po("datefeatures", cyclic = TRUE) output = train_pipeop(po, inputs = list(task))$output expect_true(all(apply(output$data(cols = output$feature_names[- (1L:4L)]), 2, duplicated)[-1L, ])) }) @@ -198,7 +198,7 @@ test_that("PipeOpDateFeatures - two POSIXct variables", { dat$date2 = sample(seq(as.POSIXct("2020-02-29"), to = as.POSIXct("2020-04-01"), by = "sec"), size = 150L) task = TaskClassif$new("iris_date", backend = dat, target = "Species") - po = PipeOpDateFeatures$new(param_vals = list(keep_date_var = TRUE, cyclic = TRUE)) + po = po("datefeatures", keep_date_var = TRUE, cyclic = TRUE) expect_identical(train_pipeop(po, inputs = list(task))$output$feature_names, c("Petal.Length", "Petal.Width", "Sepal.Length", "Sepal.Width", "date1", "date2", c(paste0(rep(c("date1.", "date2."), each = 10L), diff --git a/tests/testthat/test_pipeop_learnerquantiles.R b/tests/testthat/test_pipeop_learnerquantiles.R index eae4e0790..8458915a9 100644 --- a/tests/testthat/test_pipeop_learnerquantiles.R +++ b/tests/testthat/test_pipeop_learnerquantiles.R @@ -128,7 +128,7 @@ test_that("PipeOpLearnerQuantiles - integration with larger graph", { test_that("marshal", { lrn = lrn("regr.debug") - lrn$properties = c(lrn$properties, "marshal") + lrn$.__enclos_env__$private$.properties = c(lrn$properties, "marshal") task = tsk("mtcars") po = PipeOpLearnerQuantiles$new(lrn) @@ -148,7 +148,7 @@ test_that("marshal", { test_that("marshal multiplicity", { lrn = lrn("regr.debug") - lrn$properties = c(lrn$properties, "marshal") + lrn$.__enclos_env__$private$.properties = c(lrn$properties, "marshal") po = PipeOpLearnerQuantiles$new(lrn) task1 = mlr_tasks$get("mtcars") @@ -166,7 +166,7 @@ test_that("marshal multiplicity", { test_that("state class and multiplicity", { lrn = lrn("regr.debug") - lrn$properties = c(lrn$properties, "marshal") + lrn$.__enclos_env__$private$.properties = c(lrn$properties, "marshal") po = PipeOpLearnerQuantiles$new(lrn) task1 = mlr_tasks$get("mtcars") From c851b8d0fea9bf50a783a9abe6c7572a23f2c7be Mon Sep 17 00:00:00 2001 From: mb706 Date: Fri, 15 Aug 2025 13:57:59 +0200 Subject: [PATCH 27/31] dictionary tests --- tests/testthat/test_dictionary.R | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/testthat/test_dictionary.R b/tests/testthat/test_dictionary.R index b904ffd18..0e2ef1182 100644 --- a/tests/testthat/test_dictionary.R +++ b/tests/testthat/test_dictionary.R @@ -166,12 +166,13 @@ test_that("Dictionary contains all PipeOps", { # construct the `param_vals = list(PARNAME = PARVAL)` construction argument parvals = list(val) names(parvals) = testingparam + parvals = insert_named(parvals, args$param_vals) # check that the constructed object is different from the test_obj, but setting the test_obj's parameter # makes them equal again. - dict_constructed = do.call(mlr_pipeops$get, c(list(dictname), args)) + dict_constructed = do.call(mlr_pipeops$get, c(list(dictname), args[names(args) != "param_vals"])) dict_constructed$param_set$set_values(.values = parvals) - gen_constructed = do.call(pogen$new, args) + gen_constructed = do.call(pogen$new, args[names(args) != "param_vals"]) gen_constructed$param_set$set_values(.values = parvals) expect_false(isTRUE(all.equal(dict_constructed, test_obj)), dictname) expect_false(isTRUE(all.equal(dict_constructed$hash, test_obj$hash)), dictname) From f70c4a05114e08fee98bd62dc3cd6ec6b2afb095 Mon Sep 17 00:00:00 2001 From: mb706 Date: Fri, 15 Aug 2025 15:38:04 +0200 Subject: [PATCH 28/31] deprecation message rename --- R/PipeOp.R | 2 +- tests/testthat/setup.R | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/PipeOp.R b/R/PipeOp.R index 1ed005cb0..a3ea26011 100644 --- a/R/PipeOp.R +++ b/R/PipeOp.R @@ -281,7 +281,7 @@ PipeOp = R6Class("PipeOp", unnamed_dots = dots[is.na(names2(dots))] passes_id = length(unnamed_dots) && !is.null(newcall$id) && identical(newcall$id, unnamed_dots[[1]]) if (passes_param_vals || passes_id) { - deprecated_component("passing param_vals, and unnamed id, for PipeOp construction directly is deprecated and will be removed in the future. + mlr3component_deprecation_msg("passing param_vals, and unnamed id, for PipeOp construction directly is deprecated and will be removed in the future. Use the po()-syntax to set these, instead: po(\"pipeop\", \"newid\", param_vals = list(a = 1)) --> po(\"pipeop\", id = \"newid\", a = 1)") } diff --git a/tests/testthat/setup.R b/tests/testthat/setup.R index 746abfe3e..c0fabb82c 100644 --- a/tests/testthat/setup.R +++ b/tests/testthat/setup.R @@ -7,7 +7,7 @@ options(warnPartialMatchArgs = TRUE) options(warnPartialMatchAttr = TRUE) options(warnPartialMatchDollar = TRUE) options(mlr3.warn_deprecated = FALSE) # avoid triggers when expect_identical() accesses deprecated fields -options(mlr3.on_deprecated = "error") +options(mlr3.on_deprecated_mlr3component = "error") # simulate packages that extend existing task type x = mlr3::mlr_reflections From 7b8b5847466192cf1a8a1a05ab7593909a3adf67 Mon Sep 17 00:00:00 2001 From: mb706 Date: Fri, 15 Aug 2025 15:59:28 +0200 Subject: [PATCH 29/31] dictionary tests --- tests/testthat/test_dictionary.R | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/testthat/test_dictionary.R b/tests/testthat/test_dictionary.R index 0e2ef1182..f3c392dee 100644 --- a/tests/testthat/test_dictionary.R +++ b/tests/testthat/test_dictionary.R @@ -133,7 +133,9 @@ test_that("Dictionary contains all PipeOps", { expect_equal(other_obj$hash, test_obj$hash, info = paste(dictname, "$new id test 2")) } expect_equal(other_obj$phash, test_obj$phash, info = paste(dictname, "$new id test 2")) - expect_equal(inflate(do.call(pogen$new, args)), test_obj, info = dictname) + other_obj = inflate(do.call(pogen$new, args[names(args) != "param_vals"])) + other_obj$param_set$set_values(.values = args$param_vals) + expect_equal(other_obj, test_obj, info = dictname) tops = test_obj$param_set From bafbc212ef54b0c767e547f7be3eab99dcf9e44e Mon Sep 17 00:00:00 2001 From: mb706 Date: Fri, 15 Aug 2025 16:19:59 +0200 Subject: [PATCH 30/31] dictionary test fix --- tests/testthat/test_dictionary.R | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/testthat/test_dictionary.R b/tests/testthat/test_dictionary.R index f3c392dee..42e104899 100644 --- a/tests/testthat/test_dictionary.R +++ b/tests/testthat/test_dictionary.R @@ -134,10 +134,11 @@ test_that("Dictionary contains all PipeOps", { } expect_equal(other_obj$phash, test_obj$phash, info = paste(dictname, "$new id test 2")) other_obj = inflate(do.call(pogen$new, args[names(args) != "param_vals"])) - other_obj$param_set$set_values(.values = args$param_vals) + if ("param_vals" %in% names(args)) { + other_obj$param_set$set_values(.values = args$param_vals) + } expect_equal(other_obj, test_obj, info = dictname) - tops = test_obj$param_set # we now check if hyperparameters can be changed through construction # we do this by automatically generating a hyperparameter value that deviates from the automatically constructed one. From ac26d0cc7d9012e274cf3a834c5ebd097b3a9bc2 Mon Sep 17 00:00:00 2001 From: mb706 Date: Fri, 15 Aug 2025 17:00:51 +0200 Subject: [PATCH 31/31] filter active binding --- R/PipeOpFilter.R | 12 +++++++++--- tests/testthat/test_dictionary.R | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/R/PipeOpFilter.R b/R/PipeOpFilter.R index 40bf5f3a9..701e4485e 100644 --- a/R/PipeOpFilter.R +++ b/R/PipeOpFilter.R @@ -113,10 +113,9 @@ PipeOpFilter = R6Class("PipeOpFilter", inherit = PipeOpTaskPreprocSimple, public = list( - filter = NULL, initialize = function(filter, id = filter$id, param_vals = list()) { assert_class(filter, "Filter") - self$filter = filter$clone(deep = TRUE) + private$.filter = filter$clone(deep = TRUE) for (pn in self$filter$param_set$ids()) { self$filter$param_set$tags[[pn]] = union(self$filter$param_set$tags[[pn]] , "train") } @@ -129,6 +128,12 @@ PipeOpFilter = R6Class("PipeOpFilter", super$initialize(id, alist(filter = private$.outer_param_set, self$filter$param_set), param_vals = param_vals, tags = "feature selection", dict_entry = "filter") } ), + active = list( + filter = function(rhs) { + if (!missing(rhs) && !identical(rhs, private$.filter)) stop("filter is read-only") + private$.filter + } + ), private = list( .outer_param_set = NULL, @@ -186,7 +191,8 @@ PipeOpFilter = R6Class("PipeOpFilter", .transform = function(task) { task$select(self$state$features) }, - .additional_phash_input = function() self$filter$hash + .additional_phash_input = function() self$filter$hash, + .filter = NULL ) ) diff --git a/tests/testthat/test_dictionary.R b/tests/testthat/test_dictionary.R index 42e104899..7df3d37f1 100644 --- a/tests/testthat/test_dictionary.R +++ b/tests/testthat/test_dictionary.R @@ -169,7 +169,7 @@ test_that("Dictionary contains all PipeOps", { # construct the `param_vals = list(PARNAME = PARVAL)` construction argument parvals = list(val) names(parvals) = testingparam - parvals = insert_named(parvals, args$param_vals) + parvals = insert_named(args$param_vals, parvals) # check that the constructed object is different from the test_obj, but setting the test_obj's parameter # makes them equal again.