TorchDescriptor {mlr3torch}R Documentation

Base Class for Torch Descriptors

Description

Abstract Base Class from which TorchLoss, TorchOptimizer, and TorchCallback inherit. This class wraps a generator (R6Class Generator or the torch version of such a generator) and annotates it with metadata such as a ParamSet, a label, an ID, packages, or a manual page.

The parameters are the construction arguments of the wrapped generator and the parameter ⁠$values⁠ are passed to the generator when calling the public method ⁠$generate()⁠.

Parameters

Defined by the constructor argument param_set. All parameters are tagged with "train", but this is done automatically during initialize.

Public fields

label

(character(1))
Label for this object. Can be used in tables, plot and text output instead of the ID.

param_set

(ParamSet)
Set of hyperparameters.

packages

(character(1))
Set of required packages. These packages are loaded, but not attached.

id

(character(1))
Identifier of the object. Used in tables, plot and text output.

generator

The wrapped generator that is described.

man

(character(1))
String in the format ⁠[pkg]::[topic]⁠ pointing to a manual page for this object.

Active bindings

phash

(character(1))
Hash (unique identifier) for this partial object, excluding some components which are varied systematically (e.g. the parameter values).

Methods

Public methods


Method new()

Creates a new instance of this R6 class.

Usage
TorchDescriptor$new(
  generator,
  id = NULL,
  param_set = NULL,
  packages = NULL,
  label = NULL,
  man = NULL
)
Arguments
generator

The wrapped generator that is described.

id

(character(1))
The id for of the new object.

param_set

(ParamSet)
The parameter set.

packages

(character())
The R packages this object depends on.

label

(character(1))
Label for the new instance.

man

(character(1))
String in the format ⁠[pkg]::[topic]⁠ pointing to a manual page for this object. The referenced help package can be opened via method ⁠$help()⁠.


Method print()

Prints the object

Usage
TorchDescriptor$print(...)
Arguments
...

any


Method generate()

Calls the generator with the given parameter values.

Usage
TorchDescriptor$generate()

Method help()

Displays the help file of the wrapped object.

Usage
TorchDescriptor$help()

Method clone()

The objects of this class are cloneable with this method.

Usage
TorchDescriptor$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

See Also

Other Torch Descriptor: TorchCallback, TorchLoss, TorchOptimizer, as_torch_callbacks(), as_torch_loss(), as_torch_optimizer(), mlr3torch_losses, mlr3torch_optimizers, t_clbk(), t_loss(), t_opt()


[Package mlr3torch version 0.1.0 Index]