Extracts Simple Features from Functional Columns
Source:R/PipeOpFDAExtract.R
mlr_pipeops_fda.extract.Rd
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.
Parameters
The parameters are the parameters inherited from PipeOpTaskPreprocSimple
,
as well as the following parameters:
drop
::logical(1)
Whether to drop the originalfunctional
features and only keep the extracted features. Note that this does not remove the features from the backend, but only from the active column rolefeature
. Initial value isTRUE
.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
andvalue
and returns anumeric
. For string elements, the following predefined features are available:"mean"
,"max"
,"min"
,"slope"
,"median"
,"var"
. Initial isc("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 isInf
.
Naming
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.
Super classes
mlr3pipelines::PipeOp
-> mlr3pipelines::PipeOpTaskPreproc
-> mlr3pipelines::PipeOpTaskPreprocSimple
-> PipeOpFDAExtract
Methods
Method new()
Initializes a new instance of this Class.
Usage
PipeOpFDAExtract$new(id = "fda.extract", param_vals = list())
Arguments
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. Defaultlist()
.
Examples
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
#> <TaskRegr:fuel> (129 x 4): Spectral Data of Fossil Fuels
#> * Target: heatan
#> * Properties: -
#> * Features (3):
#> - dbl (3): NIR_mean, UVVIS_mean, h20