Smoothes functional data using tf::tf_smooth()
.
This preprocessing operator is similar to PipeOpFDAInterpol
, however it does not interpolate to unobserved
x-values, but rather smooths the observed values.
Parameters
The parameters are the parameters inherited from PipeOpTaskPreprocSimple
,
as well as the following parameters:
method
::character(1)
One of:"lowess"
: locally weighted scatterplot smoothing (default)"rollmean"
: rolling mean"rollmedian"
: rolling meadian"savgol"
: Savitzky-Golay filtering
All methods but
"lowess"
ignore non-equidistant arg values.args
:: namedlist()
List of named arguments that is passed totf_smooth()
. See the help page oftf_smooth()
for default values.verbose
::logical(1)
Whether to print messages during the transformation. Is initialized toFALSE
.
Super classes
mlr3pipelines::PipeOp
-> mlr3pipelines::PipeOpTaskPreproc
-> mlr3pipelines::PipeOpTaskPreprocSimple
-> PipeOpFDASmooth
Methods
Method new()
Initializes a new instance of this Class.
Usage
PipeOpFDASmooth$new(id = "fda.smooth", param_vals = list())
Examples
task = tsk("fuel")
po_smooth = po("fda.smooth", method = "rollmean", args = list(k = 5))
task_smooth = po_smooth$train(list(task))[[1L]]
task_smooth
#> <TaskRegr:fuel> (129 x 4): Spectral Data of Fossil Fuels
#> * Target: heatan
#> * Properties: -
#> * Features (3):
#> - tfr (2): NIR, UVVIS
#> - dbl (1): h20
task_smooth$data(cols = c("NIR", "UVVIS"))
#> NIR UVVIS
#> <tfd_reg> <tfd_reg>
#> 1: ▇▇▇█████████████████████▇▇ ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇█████████
#> 2: ▆▇▇▇▇▇▇▇▇█████████████████ ▁▁▁▁▁▁▁▁▁▁▁▁▂▂▂▂▂▂▂▂▂▃▃▃▃▃
#> 3: ▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅ ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▄▄▄▄▄▄▄▄▄▄▄▄
#> 4: ▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅ ▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃
#> 5: ▄▅▅▅▅▅▅▅▅▅▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆ ▂▂▂▂▁▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▃▃▃▃▃▃
#> ---
#> 125: ▅▅▅▅▅▅▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆ ▂▂▃▂▂▂▂▂▂▂▂▂▂▂▃▃▃▃▃▃▃▃▃▃▃▃
#> 126: ▂▂▂▂▂▃▃▃▃▃▃▃▄▄▄▄▄▄▄▄▅▅▅▅▅▆ ▂▂▂▂▂▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▂▂▂▂▂
#> 127: ▁▁▁▁▂▂▂▂▂▂▃▃▃▃▃▄▄▄▄▄▄▄▅▅▅▆ ▂▂▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▂▂
#> 128: ▅▅▅▅▅▅▆▆▆▆▆▆▆▆▆▆▇▇▇▆▆▆▆▆▆▆ ▆▆▆▆▆▆▆▆▆▅▅▅▅▅▅▆▆▆▆▆▆▆▆▆▆▆
#> 129: ▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▅▅▅▅ ▂▂▂▂▂▂▂▂▂▂▂▂▂▃▃▃▃▃▃▃▃▃▃▃▃▃