Skip to content

Commit faab712

Browse files
committed
Merge branch 'master' into ppl_bagging_with_replacement
2 parents 22ecbfc + 99465b4 commit faab712

File tree

13 files changed

+51
-19
lines changed

13 files changed

+51
-19
lines changed

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"

.github/workflows/dev-cmd-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- {os: ubuntu-latest, r: 'release', dev-package: "mlr-org/bbotk', 'mlr-org/mlr3learners', 'mlr-org/paradox"}
2828

2929
steps:
30-
- uses: actions/checkout@v3
30+
- uses: actions/checkout@v4
3131

3232
- uses: r-lib/actions/setup-r@v2
3333
with:

.github/workflows/pkgdown.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
env:
2424
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
2525
steps:
26-
- uses: actions/checkout@v3
26+
- uses: actions/checkout@v4
2727

2828
- uses: r-lib/actions/setup-pandoc@v2
2929

@@ -44,7 +44,7 @@ jobs:
4444

4545
- name: Deploy
4646
if: github.event_name != 'pull_request'
47-
uses: JamesIves/github-pages-deploy-action@v4.4.1
47+
uses: JamesIves/github-pages-deploy-action@v4.5.0
4848
with:
4949
clean: false
5050
branch: gh-pages

.github/workflows/r-cmd-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
- {os: ubuntu-latest, r: 'release'}
2929

3030
steps:
31-
- uses: actions/checkout@v3
31+
- uses: actions/checkout@v4
3232

3333
- uses: r-lib/actions/setup-r@v2
3434
with:

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ Config/testthat/edition: 3
9393
Config/testthat/parallel: true
9494
NeedsCompilation: no
9595
Roxygen: list(markdown = TRUE, r6 = FALSE)
96-
RoxygenNote: 7.2.3
96+
RoxygenNote: 7.2.3.9000
9797
VignetteBuilder: knitr
9898
Collate:
9999
'Graph.R'

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ import(mlr3)
148148
import(mlr3misc)
149149
import(paradox)
150150
importFrom(R6,R6Class)
151+
importFrom(data.table,as.data.table)
151152
importFrom(digest,digest)
152153
importFrom(stats,setNames)
153154
importFrom(utils,bibentry)

NEWS.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# mlr3pipelines 0.5.0-9000
22

3-
* `pipeline_bagging()` gets the `replace` argument.
4-
* Compatibility with upcoming paradox release
3+
* `pipeline_bagging()` gets the `replace` argument (old behaviour `FALSE` by default).
4+
* Feature: The `$add_pipeop()` method got an argument `clone` (old behaviour `TRUE` by default).
5+
* Bugfix: `PipeOpFeatureUnion` in some rare cases dropped variables called `"x"`.
6+
* Compatibility with upcoming paradox release.
57

68
# mlr3pipelines 0.5.0-2
79

R/Graph.R

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
#' * `phash` :: `character(1)` \cr
6060
#' Stores a checksum calculated on the [`Graph`] configuration, which includes all [`PipeOp`] hashes
6161
#' *except* their `$param_set$values`, and a hash of `$edges`.
62-
#' * `keep_results` :: `logical(1)` \cr
62+
#' * `keep_results` :: `logical(1)`\cr
6363
#' Whether to store intermediate results in the [`PipeOp`]'s `$.result` slot, mostly for debugging purposes. Default `FALSE`.
6464
#' * `man` :: `character(1)`\cr
6565
#' Identifying string of the help page that shows with `help()`.
@@ -69,13 +69,14 @@
6969
#' (`logical(1)`) -> `character` \cr
7070
#' Get IDs of all [`PipeOp`]s. This is in order that [`PipeOp`]s were added if
7171
#' `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
7474
#' Mutates [`Graph`] by adding a [`PipeOp`] to the [`Graph`]. This does not add any edges, so the new [`PipeOp`]
7575
#' will not be connected within the [`Graph`] at first.\cr
7676
#' Instead of supplying a [`PipeOp`] directly, an object that can naturally be converted to a [`PipeOp`] can also
7777
#' 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
7980
#' Note that `$add_pipeop()` is a relatively low-level operation, it is recommended to build graphs using [`%>>%`].
8081
#' * `add_edge(src_id, dst_id, src_channel = NULL, dst_channel = NULL)` \cr
8182
#' (`character(1)`, `character(1)`,
@@ -181,8 +182,8 @@ Graph = R6Class("Graph",
181182
topo_sort(tmp)$id
182183
},
183184

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))
186187
if (op$id %in% names(self$pipeops)) {
187188
stopf("PipeOp with id '%s' already in Graph", op$id)
188189
}

R/PipeOpFeatureUnion.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ cbind_tasks = function(inputs, assert_targets_equal, inprefix) {
202202
# again done by reference
203203
new_features = unlist(c(list(data.table(x = vector(length = task$nrow))),
204204
map(tail(inputs, -1L), .f = function(y) y$data(ids, cols = y$feature_names))), recursive = FALSE)
205+
names(new_features)[1] = make.unique(rev(names(new_features)))[[length(new_features)]]
205206

206207
# we explicitly have to subset to the unique column names, otherwise task$cbind() complains for data.table backends
207208
new_features = new_features[unique(names(new_features))]

R/assert_graph.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ as_graph = function(x, clone = FALSE) {
3939
}
4040

4141
#' @export
42-
as_graph.default = function(x, clone = FALSE) {
43-
Graph$new()$add_pipeop(x) # add_pipeop always clones and checks automatically for convertability
42+
as_graph.default = function(x, clone = TRUE) {
43+
# different default than other methods for backwards compatibility
44+
# previously $add_pipeop() always cloned its input
45+
Graph$new()$add_pipeop(x, clone = clone)
4446
}
4547

4648
#' @export

0 commit comments

Comments
 (0)