mlr_pipeops_torch_optimizer {mlr3torch}R Documentation

Optimizer Configuration

Description

Configures the optimizer of a deep learning model.

Input and Output Channels

There is one input channel "input" and one output channel "output". During training, the channels are of class ModelDescriptor. During prediction, the channels are of class Task.

State

The state is the value calculated by the public method shapes_out().

Parameters

The parameters are defined dynamically from the optimizer that is set during construction.

Internals

During training, the optimizer is cloned and added to the ModelDescriptor. Note that the parameter set of the stored TorchOptimizer is reference-identical to the parameter set of the pipeop itself.

Super class

mlr3pipelines::PipeOp -> PipeOpTorchOptimizer

Methods

Public methods

Inherited methods

Method new()

Creates a new instance of this R6 class.

Usage
PipeOpTorchOptimizer$new(
  optimizer = t_opt("adam"),
  id = "torch_optimizer",
  param_vals = list()
)
Arguments
optimizer

(TorchOptimizer or character(1) or torch_optimizer_generator)
The optimizer (or something convertible via as_torch_optimizer()).

id

(character(1))
Identifier of the resulting object.

param_vals

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


Method clone()

The objects of this class are cloneable with this method.

Usage
PipeOpTorchOptimizer$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

See Also

Other PipeOp: mlr_pipeops_module, mlr_pipeops_torch_callbacks

Other Model Configuration: ModelDescriptor(), mlr_pipeops_torch_callbacks, mlr_pipeops_torch_loss, model_descriptor_union()

Examples


po_opt = po("torch_optimizer", "sgd", lr = 0.01)
po_opt$param_set
mdin = po("torch_ingress_num")$train(list(tsk("iris")))
mdin[[1L]]$optimizer
mdout = po_opt$train(mdin)
mdout[[1L]]$optimizer


[Package mlr3torch version 0.1.0 Index]