mlr_pipeops_fda.extract {mlr3fda} | R Documentation |
This is the class that extracts simple features from functional columns. Note that it only operates on values that were actually observed and does not interpolate.
The parameters are the parameters inherited from PipeOpTaskPreprocSimple
,
as well as the following parameters:
drop
:: logical(1)
Whether to drop the original functional
features and only keep the extracted features.
Note that this does not remove the features from the backend, but only from the active
column role feature
. Initial value is TRUE
.
features
:: list()
| character()
A list of features to extract. Each element can be either a function or a string.
If the element if is function it requires the following arguments: arg
and value
and returns a numeric
.
For string elements, the following predefined features are available:
"mean"
, "max"
,"min"
,"slope"
,"median"
,"var"
.
Initial is c("mean", "max", "min", "slope", "median", "var")
left
:: numeric()
The left boundary of the window. Initial is -Inf
.
The window is specified such that the all values >=left and <=right are kept for the computations.
right
:: numeric()
The right boundary of the window. Initial is Inf
.
The new names generally append a _{feature}
to the corresponding column name.
However this can lead to name clashes with existing columns.
This is solved as follows:
If a column was called "x"
and the feature is "mean"
, the corresponding new column will
be called "x_mean"
. In case of duplicates, unique names are obtained using make.unique()
and
a warning is given.
mlr3pipelines::PipeOp
-> mlr3pipelines::PipeOpTaskPreproc
-> mlr3pipelines::PipeOpTaskPreprocSimple
-> PipeOpFDAExtract
new()
Initializes a new instance of this Class.
PipeOpFDAExtract$new(id = "fda.extract", param_vals = list())
id
(character(1)
)
Identifier of resulting object, default is "fda.extract"
.
param_vals
(named list
)
List of hyperparameter settings, overwriting the hyperparameter settings that would
otherwise be set during construction. Default list()
.
clone()
The objects of this class are cloneable with this method.
PipeOpFDAExtract$clone(deep = FALSE)
deep
Whether to make a deep clone.
task = tsk("fuel")
po_fmean = po("fda.extract", features = "mean")
task_fmean = po_fmean$train(list(task))[[1L]]
# add more than one feature
pop = po("fda.extract", features = c("mean", "median", "var"))
task_features = pop$train(list(task))[[1L]]
# add a custom feature
po_custom = po("fda.extract",
features = list(mean = function(arg, value) mean(value, na.rm = TRUE))
)
task_custom = po_custom$train(list(task))[[1L]]
task_custom