mlr_pipeops_multioutlrn: PipeOpMultiLearner

Description Format Input and Output Channels State Parameters Internals Methods Super class Active bindings Methods See Also Examples

Description

Wraps a list of mlr3::Learners into a PipeOp.

Inherits the $param_sets (and therefore $param_set$values) from all Learners it is constructed from.

Format

R6Class object inheriting from PipeOp.

Input and Output Channels

PipeOpMultiLearner has one input channel named "input", taking a Task specific to the Learner type given to learner during construction; both during training and prediction.

PipeOpMultiLearner has one output channel named "output", producing NULL during training and a Multiplicity of Predictions during prediction; this subclass is specific to the Learner type given to learner during construction.

The output during prediction is a Multiplicity of Predictions on the input data, produced by the Learners trained on the training input data.

State

The $state is set to the $state slot of the Learner object. It is a named list with members: of states for each separate Task provided via the incoming Multiplicity.\ Each element contains the following slots:

Parameters

The parameters are exactly the parameters of the Learners wrapped by this object.

Internals

The $state is currently not updated by prediction, so the $state$predict_log and $state$predict_time will always be NULL.

Methods

Methods inherited from PipeOp.

Super class

mlr3pipelines::PipeOp -> PipeOpMultiLearner

Active bindings

id

(character(1))
Access or set the id.

learners

(list())
Access the stored learners.

learner_models

(list())
Access the trained learners.

predict_types

(list())
Access the predict_types.

Methods

Public methods

Inherited methods

Method new()

Initialize a new R6 class.

Usage
PipeOpMultiLearner$new(learners, id = NULL, param_vals = list())
Arguments
learners

list()
List of Learner | character(1), either:

  • One learner for each task_type

  • One learner for each target, requires list to be named with the Task's target_names.

id

character(1)
Identifier of the resulting object, internally defaulting to the combined ids of the Learner being wrapped.

param_vals

named list
List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default list().


Method clone()

The objects of this class are cloneable with this method.

Usage
PipeOpMultiLearner$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

See Also

Other PipeOps: mlr_pipeops_multioutsplit, mlr_pipeops_multioutunite

Other Multiplicity PipeOps: mlr_pipeops_multioutsplit, mlr_pipeops_multioutunite

Other Experimental Features: mlr_pipeops_multioutsplit, mlr_pipeops_multioutunite

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
library("mlr3")
library("mlr3pipelines")

task = tsk("linnerud")
learners = list(
  classif = lrn("classif.rpart", cp = 0.1),
  regr = lrn("regr.rpart")
)
lrn_po = mlr_pipeops$get("multioutlrn", learners)

# Train the graph
gr = po("multioutsplit") %>>% lrn_po
gr$train(task)
gr$predict(task)

mlr-org/mlr3multioutput documentation built on Nov. 22, 2020, 1:17 p.m.