Create
a
PipeOpfrommlr_pipeopsfrom given IDa
PipeOpLearnerfrom aLearnerobjecta
PipeOpFilterfrom aFilterobjecta
PipeOpSelectfrom aSelectorobjecta clone of a
PipeOpfrom a givenPipeOp(possibly with changed settings)
The object is initialized with given parameters and param_vals.
po() taks a single obj (PipeOp id, Learner, ...) and converts
it to a PipeOp. pos() (with plural-s) takes either a character-vector, or a
list of objects, and creates a list of PipeOps.
Arguments
- .obj
[any]
The object from which to construct aPipeOp. If this is acharacter(1), it is looked up in themlr_pipeopsdictionary. Otherwise, it is converted to aPipeOp.- ...
any
Additional parameters to give to constructed object. This may be an argument of the constructor of thePipeOp, in which case it is given to this constructor; or it may be a parameter value, in which case it is given to theparam_valsargument of the constructor.- .objs
character|list
Either acharacterofPipeOps to look up inmlr_pipeops, or a list of other objects to be converted to aPipeOp. If this is a namedlist, then the names are used as$idslot for the resultingPipeOps.
Examples
library("mlr3")
po("learner", lrn("classif.rpart"), cp = 0.3)
#> PipeOp: <classif.rpart> (not trained)
#> values: <cp=0.3, xval=0>
#> Input channels <name [train type, predict type]>:
#> input [TaskClassif,TaskClassif]
#> Output channels <name [train type, predict type]>:
#> output [NULL,PredictionClassif]
po(lrn("classif.rpart"), cp = 0.3)
#> PipeOp: <classif.rpart> (not trained)
#> values: <cp=0.3, xval=0>
#> Input channels <name [train type, predict type]>:
#> input [TaskClassif,TaskClassif]
#> Output channels <name [train type, predict type]>:
#> output [NULL,PredictionClassif]
# is equivalent with:
mlr_pipeops$get("learner", lrn("classif.rpart"),
param_vals = list(cp = 0.3))
#> PipeOp: <classif.rpart> (not trained)
#> values: <cp=0.3, xval=0>
#> Input channels <name [train type, predict type]>:
#> input [TaskClassif,TaskClassif]
#> Output channels <name [train type, predict type]>:
#> output [NULL,PredictionClassif]
mlr3pipelines::pos(c("pca", original = "nop"))
#> $pca
#> PipeOp: <pca> (not trained)
#> values: <list()>
#> Input channels <name [train type, predict type]>:
#> input [Task,Task]
#> Output channels <name [train type, predict type]>:
#> output [Task,Task]
#>
#> $original
#> PipeOp: <original> (not trained)
#> values: <list()>
#> Input channels <name [train type, predict type]>:
#> input [*,*]
#> Output channels <name [train type, predict type]>:
#> output [*,*]
#>
