|
59 | 59 | #' * `phash` :: `character(1)` \cr |
60 | 60 | #' Stores a checksum calculated on the [`Graph`] configuration, which includes all [`PipeOp`] hashes |
61 | 61 | #' *except* their `$param_set$values`, and a hash of `$edges`. |
62 | | -#' * `keep_results` :: `logical(1)` \cr |
| 62 | +#' * `keep_results` :: `logical(1)`\cr |
63 | 63 | #' Whether to store intermediate results in the [`PipeOp`]'s `$.result` slot, mostly for debugging purposes. Default `FALSE`. |
64 | 64 | #' * `man` :: `character(1)`\cr |
65 | 65 | #' Identifying string of the help page that shows with `help()`. |
|
69 | 69 | #' (`logical(1)`) -> `character` \cr |
70 | 70 | #' Get IDs of all [`PipeOp`]s. This is in order that [`PipeOp`]s were added if |
71 | 71 | #' `sorted` is `FALSE`, and topologically sorted if `sorted` is `TRUE`. |
72 | | -#' * `add_pipeop(op)` \cr |
73 | | -#' ([`PipeOp`] | [`Learner`][mlr3::Learner] | [`Filter`][mlr3filters::Filter] | `...`) -> `self` \cr |
| 72 | +#' * `add_pipeop(op, clone = TRUE)` \cr |
| 73 | +#' ([`PipeOp`] | [`Learner`][mlr3::Learner] | [`Filter`][mlr3filters::Filter] | `...`, `logical(1)`) -> `self` \cr |
74 | 74 | #' Mutates [`Graph`] by adding a [`PipeOp`] to the [`Graph`]. This does not add any edges, so the new [`PipeOp`] |
75 | 75 | #' will not be connected within the [`Graph`] at first.\cr |
76 | 76 | #' Instead of supplying a [`PipeOp`] directly, an object that can naturally be converted to a [`PipeOp`] can also |
77 | 77 | #' be supplied, e.g. a [`Learner`][mlr3::Learner] or a [`Filter`][mlr3filters::Filter]; see [`as_pipeop()`]. |
78 | | -#' The argument given as `op` is always cloned; to access a `Graph`'s [`PipeOp`]s by-reference, use `$pipeops`.\cr |
| 78 | +#' The argument given as `op` is cloned if `clone` is `TRUE` (default); to access a `Graph`'s [`PipeOp`]s |
| 79 | +#' by-reference, use `$pipeops`.\cr |
79 | 80 | #' Note that `$add_pipeop()` is a relatively low-level operation, it is recommended to build graphs using [`%>>%`]. |
80 | 81 | #' * `add_edge(src_id, dst_id, src_channel = NULL, dst_channel = NULL)` \cr |
81 | 82 | #' (`character(1)`, `character(1)`, |
@@ -181,8 +182,8 @@ Graph = R6Class("Graph", |
181 | 182 | topo_sort(tmp)$id |
182 | 183 | }, |
183 | 184 |
|
184 | | - add_pipeop = function(op) { |
185 | | - op = as_pipeop(op, clone = TRUE) |
| 185 | + add_pipeop = function(op, clone = TRUE) { |
| 186 | + op = as_pipeop(op, clone = assert_flag(clone)) |
186 | 187 | if (op$id %in% names(self$pipeops)) { |
187 | 188 | stopf("PipeOp with id '%s' already in Graph", op$id) |
188 | 189 | } |
|
0 commit comments