Skip to content

Commit c7aeab9

Browse files
authored
Merge branch 'master' into bundle
2 parents 4fa0463 + fa84ba0 commit c7aeab9

File tree

118 files changed

+732
-14
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+732
-14
lines changed

DESCRIPTION

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: mlr3pipelines
22
Title: Preprocessing Operators and Pipelines for 'mlr3'
3-
Version: 0.5.1-9000
3+
Version: 0.5.2-9000
44
Authors@R:
55
c(person(given = "Martin",
66
family = "Binder",
@@ -86,7 +86,8 @@ Suggests:
8686
GenSA,
8787
methods,
8888
vtreat,
89-
future
89+
future,
90+
htmlwidgets
9091
ByteCompile: true
9192
Encoding: UTF-8
9293
Config/testthat/edition: 3
@@ -175,6 +176,7 @@ Collate:
175176
'operators.R'
176177
'pipeline_bagging.R'
177178
'pipeline_branch.R'
179+
'pipeline_convert_types.R'
178180
'pipeline_greplicate.R'
179181
'pipeline_ovr.R'
180182
'pipeline_robustify.R'

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ export(mlr_graphs)
127127
export(mlr_pipeops)
128128
export(pipeline_bagging)
129129
export(pipeline_branch)
130+
export(pipeline_convert_types)
130131
export(pipeline_greplicate)
131132
export(pipeline_ovr)
132133
export(pipeline_robustify)

NEWS.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
# mlr3pipelines 0.5.1-9000
1+
# mlr3pipelines 0.5.2-9000
2+
3+
# mlr3pipelines 0.5.2
4+
5+
* Added new `ppl("convert_types")`.
6+
* Minor documentation fixes.
7+
* Test helpers are now available in `inst/`. These are considered experimental and unstable.
28

39
* Added marshaling support to `GraphLearner`
410

R/GraphLearner.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
#' @family Learners
6969
#' @export
7070
#' @examples
71+
#' \dontshow{ if (requireNamespace("rpart")) \{ }
7172
#' library("mlr3")
7273
#'
7374
#' graph = po("pca") %>>% lrn("classif.rpart")
@@ -86,6 +87,7 @@
8687
#'
8788
#' # Feature importance (of principal components):
8889
#' lr$graph_model$pipeops$classif.rpart$learner_model$importance()
90+
#' \dontshow{ \} }
8991
GraphLearner = R6Class("GraphLearner", inherit = Learner,
9092
public = list(
9193
initialize = function(graph, id = NULL, param_vals = list(), task_type = NULL, predict_type = NULL, clone_graph = TRUE) {

R/PipeOpBoxCox.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
#' Only methods inherited from [`PipeOpTaskPreproc`]/[`PipeOp`].
4949
#'
5050
#' @examples
51+
#' \dontshow{ if (requireNamespace("bestNormalize")) \{ }
5152
#' library("mlr3")
5253
#'
5354
#' task = tsk("iris")
@@ -57,6 +58,7 @@
5758
#' pop$train(list(task))[[1]]$data()
5859
#'
5960
#' pop$state
61+
#' \dontshow{ \} }
6062
#' @family PipeOps
6163
#' @include PipeOpTaskPreproc.R
6264
#' @template seealso_pipeopslist

R/PipeOpClassifAvg.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
#' @export
6565
#'
6666
#' @examples
67+
#' \dontshow{ if (requireNamespace("rpart")) \{ }
6768
#' \donttest{
6869
#' library("mlr3")
6970
#'
@@ -77,6 +78,7 @@
7778
#'
7879
#' resample(tsk("iris"), GraphLearner$new(gr), rsmp("holdout"))
7980
#' }
81+
#' \dontshow{ \} }
8082
PipeOpClassifAvg = R6Class("PipeOpClassifAvg",
8183
inherit = PipeOpEnsemble,
8284
public = list(

R/PipeOpEncode.R

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#' @format [`R6Class`] object inheriting from [`PipeOpTaskPreprocSimple`]/[`PipeOpTaskPreproc`]/[`PipeOp`].
66
#'
77
#' @description
8-
#' Encodes columns of type `factor`, `character` and `ordered`.
8+
#' Encodes columns of type `factor` and `ordered`.
99
#'
1010
#' Possible encodings are `"one-hot"` encoding, as well as encoding according to `stats::contr.helmert()`, `stats::contr.poly()`,
1111
#' `stats::contr.sum()` and `stats::contr.treatment()`.
@@ -14,6 +14,8 @@
1414
#'
1515
#' Use the [`PipeOpTaskPreproc`] `$affect_columns` functionality to only encode a subset of columns, or only encode columns of a certain type.
1616
#'
17+
#' `character`-type features can be encoded by converting them `factor` features first, using [`ppl("convert_types", "character", "factor")`][mlr_graphs_convert_types].
18+
#'
1719
#' @section Construction:
1820
#' ```
1921
#' PipeOpEncode$new(id = "encode", param_vals = list())
@@ -26,7 +28,7 @@
2628
#' @section Input and Output Channels:
2729
#' Input and output channels are inherited from [`PipeOpTaskPreproc`].
2830
#'
29-
#' The output is the input [`Task`][mlr3::Task] with all affected `factor`, `character` or `ordered` parameters encoded according to the `method`
31+
#' The output is the input [`Task`][mlr3::Task] with all affected `factor` and `ordered` parameters encoded according to the `method`
3032
#' parameter.
3133
#'
3234
#' @section State:
@@ -78,6 +80,14 @@
7880
#'
7981
#' poe$param_set$values$method = "sum"
8082
#' poe$train(list(task))[[1]]$data()
83+
#'
84+
#' # converting character-columns
85+
#' data_chr = data.table::data.table(x = factor(letters[1:3]), y = letters[1:3])
86+
#' task_chr = TaskClassif$new("task_chr", data_chr, "x")
87+
#'
88+
#' goe = ppl("convert_types", "character", "factor") %>>% po("encode")
89+
#'
90+
#' goe$train(task_chr)[[1]]$data()
8191
PipeOpEncode = R6Class("PipeOpEncode",
8292
inherit = PipeOpTaskPreprocSimple,
8393
public = list(

R/PipeOpEncodeLmer.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@
7272
#' @include PipeOpTaskPreproc.R
7373
#' @export
7474
#' @examples
75+
#' \dontshow{ if (requireNamespace("nloptr")) \{ }
76+
#' \dontshow{ if (requireNamespace("lme4")) \{ }
7577
#' library("mlr3")
7678
#' poe = po("encodelmer")
7779
#'
@@ -84,6 +86,8 @@
8486
#' poe$train(list(task))[[1]]$data()
8587
#'
8688
#' poe$state
89+
#' \dontshow{ \} }
90+
#' \dontshow{ \} }
8791
PipeOpEncodeLmer = R6Class("PipeOpEncodeLmer",
8892
inherit = PipeOpTaskPreprocSimple,
8993
public = list(

R/PipeOpFilter.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@
8080
#' @include PipeOpTaskPreproc.R
8181
#' @export
8282
#' @examples
83+
#' \dontshow{ if (requireNamespace("mlr3filters")) \{ }
84+
#' \dontshow{ if (requireNamespace("rpart")) \{ }
8385
#' library("mlr3")
8486
#' library("mlr3filters")
8587
#' \dontshow{data.table::setDTthreads(1)}
@@ -107,6 +109,8 @@
107109
#' learner = GraphLearner$new(gr)
108110
#' rr = resample(task, learner, rsmp("holdout"), store_models = TRUE)
109111
#' rr$learners[[1]]$model$auc$scores
112+
#' \dontshow{ \} }
113+
#' \dontshow{ \} }
110114
PipeOpFilter = R6Class("PipeOpFilter",
111115
inherit = PipeOpTaskPreprocSimple,
112116
public = list(

R/PipeOpICA.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
#' Only methods inherited from [`PipeOpTaskPreproc`]/[`PipeOp`].
7474
#'
7575
#' @examples
76+
#' \dontshow{ if (requireNamespace("fastICA")) \{ }
7677
#' library("mlr3")
7778
#'
7879
#' task = tsk("iris")
@@ -82,6 +83,7 @@
8283
#' pop$train(list(task))[[1]]$data()
8384
#'
8485
#' pop$state
86+
#' \dontshow{ \} }
8587
#' @family PipeOps
8688
#' @template seealso_pipeopslist
8789
#' @include PipeOpTaskPreproc.R

0 commit comments

Comments
 (0)