po: Shorthand PipeOp Constructor

View source: R/po.R

poR Documentation

Shorthand PipeOp Constructor

Description

Create

  • a PipeOp from mlr_pipeops from given ID

  • a PipeOpLearner from a Learner object

  • a PipeOpFilter from a Filter object

  • a PipeOpSelect from a Selector object

  • a clone of a PipeOp from a given PipeOp (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.

Usage

po(.obj, ...)

pos(.objs, ...)

Arguments

.obj

⁠[any]⁠
The object from which to construct a PipeOp. If this is a character(1), it is looked up in the mlr_pipeops dictionary. Otherwise, it is converted to a PipeOp.

...

any
Additional parameters to give to constructed object. This may be an argument of the constructor of the PipeOp, in which case it is given to this constructor; or it may be a parameter value, in which case it is given to the param_vals argument of the constructor.

.objs

character | list
Either a character of PipeOps to look up in mlr_pipeops, or a list of other objects to be converted to a PipeOp. If this is a named list, then the names are used as ⁠$id⁠ slot for the resulting PipeOps.

Value

A PipeOp (for po()), or a list of PipeOps (for pos()).

Examples


library("mlr3")

po("learner", lrn("classif.rpart"), cp = 0.3)

po(lrn("classif.rpart"), cp = 0.3)

# is equivalent with:
mlr_pipeops$get("learner", lrn("classif.rpart"),
  param_vals = list(cp = 0.3))

mlr3pipelines::pos(c("pca", original = "nop"))


mlr3pipelines documentation built on Sept. 30, 2024, 9:37 a.m.