Skip to contents

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 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.

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.

Methods

Inherited 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. Default list().


Method clone()

The objects of this class are cloneable with this method.

Usage

PipeOpFDAExtract$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

library(mlr3pipelines)

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