Function to create objects of class PipeOpTaskPreprocTorch
in a more convenient way.
Start by reading the documentation of PipeOpTaskPreprocTorch
.
Usage
pipeop_preproc_torch(
id,
fn,
shapes_out = NULL,
param_set = NULL,
packages = character(0),
rowwise = FALSE,
parent_env = parent.frame(),
stages_init = NULL,
tags = NULL
)
Arguments
- id
(
character(1)
)
The id for of the new object.- fn
(
function
)
The preprocessing function.- shapes_out
(
function
orNULL
or"infer"
)
The private.shapes_out(shapes_in, param_vals, task)
method ofPipeOpTaskPreprocTorch
(see section Inheriting). Special values areNULL
and"infer"
: IfNULL
, the output shapes are unknown. Option"infer"
usesinfer_shapes
. Method"infer"
should be correct in most cases, but might fail in some edge cases.- param_set
(
ParamSet
orNULL
)
The parameter set. If this is left asNULL
(default) the parameter set is inferred in the following way: All parameters but the first and...
offn
are set as untyped parameters with tags 'train' and those that have no default value are tagged as 'required' as well. Default values are not annotated.- packages
(
character()
)
The R packages this object depends on.- rowwise
(
logical(1)
)
Whether the preprocessing is applied row-wise.- parent_env
(
environment
)
The parent environment for the R6 class.- stages_init
(
character(1)
)
Initial value for thestages
parameter. IfNULL
(default), will be set to"both"
in case theid
starts with"trafo"
and to"train"
if it starts with"augment"
. Otherwise it must specified.(
character()
)
Tags for the pipeop
Value
An R6Class
instance inheriting from PipeOpTaskPreprocTorch
Examples
PipeOpPreprocExample = pipeop_preproc_torch("preproc_example", function(x, a) x + a)
po_example = PipeOpPreprocExample$new()
po_example$param_set
#> <ParamSet(3)>
#> id class lower upper nlevels default value
#> <char> <char> <num> <num> <num> <list> <list>
#> 1: a ParamUty NA NA Inf <NoDefault[0]> [NULL]
#> 2: stages ParamFct NA NA 3 <NoDefault[0]> [NULL]
#> 3: affect_columns ParamUty NA NA Inf <Selector[1]> [NULL]