Computes per-series summary features from the target variable via tsfeatures::tsfeatures() and broadcasts them
as constant columns to every row of the corresponding series. For an unkeyed task the features are broadcast to
every row; for a keyed task each key contributes one feature vector.
Features are cached in the state at train time and reused at predict time. Predicting on a key that was not seen during training is an error.
Parameters
The parameters are the parameters inherited from mlr3pipelines::PipeOpTaskPreproc, as well as:
features::character()
Function names from thetsfeaturesnamespace that return numeric feature vectors. Defaultc("frequency", "stl_features", "entropy", "acf_features").scale::logical(1)
IfTRUE, scale each series to mean 0 and sd 1 before feature extraction. DefaultTRUE.trim::logical(1)
IfTRUE, trim values outside±trim_amountbefore feature extraction. DefaultFALSE.trim_amount::numeric(1)
Trimming threshold. Default0.1.parallel::logical(1)
IfTRUE, compute features in parallel via afuture::plan(). DefaultFALSE.multiprocess::function
Function from thefuturepackage used whenparallel = TRUE. Defaultfuture::multisession().na.action::function
Missing-value handler. Defaultstats::na.pass().
Super classes
mlr3pipelines::PipeOp -> mlr3pipelines::PipeOpTaskPreproc -> PipeOpFcstTsfeats
Methods
PipeOpFcstTsfeats$new()
Initializes a new instance of this Class.
Usage
PipeOpFcstTsfeats$new(id = "fcst.tsfeats", param_vals = list())Examples
library(mlr3pipelines)
task = tsk("airpassengers")
po = po("fcst.tsfeats", features = c("entropy", "acf_features"))
out = po$train(list(task))[[1L]]
out$head()
#> passengers passengers_tsf_entropy passengers_tsf_x_acf1 passengers_tsf_x_acf10 passengers_tsf_diff1_acf1 passengers_tsf_diff1_acf10 passengers_tsf_diff2_acf1
#> <num> <num> <num> <num> <num> <num> <num>
#> 1: 112 0.2961049 0.9480473 5.670087 0.3028553 0.4088376 -0.1910059
#> 2: 118 0.2961049 0.9480473 5.670087 0.3028553 0.4088376 -0.1910059
#> 3: 132 0.2961049 0.9480473 5.670087 0.3028553 0.4088376 -0.1910059
#> 4: 129 0.2961049 0.9480473 5.670087 0.3028553 0.4088376 -0.1910059
#> 5: 121 0.2961049 0.9480473 5.670087 0.3028553 0.4088376 -0.1910059
#> 6: 135 0.2961049 0.9480473 5.670087 0.3028553 0.4088376 -0.1910059
#> passengers_tsf_diff2_acf10 passengers_tsf_seas_acf1
#> <num> <num>
#> 1: 0.2507803 0.760395
#> 2: 0.2507803 0.760395
#> 3: 0.2507803 0.760395
#> 4: 0.2507803 0.760395
#> 5: 0.2507803 0.760395
#> 6: 0.2507803 0.760395