Interpolate functional features (e.g. all individuals are observed at different time-points) to a common grid.
This is useful if you want to compare functional features across observations.
The interpolation is done using the tf
package. See tfd()
for details.
Parameters
The parameters are the parameters inherited from PipeOpTaskPreprocSimple
,
as well as the following parameters:
grid
::character(1)
|numeric()
The grid to use for interpolation. Ifgrid
is numeric, it must be a sequence of values to use for the grid or a single value that specifies the number of points to use for the grid, requiresleft
andright
to be specified in the latter case. Ifgrid
is a character, it must be one of:"union"
: This option creates a grid based on the union of all argument points from the provided functional features. This means that if the argument points across features are \(t_1, t_2, ..., t_n\), then the grid will be the combined unique set of these points. This option is generally used when the argument points vary across observations and a common grid is needed for comparison or further analysis."intersect"
: Creates a grid using the intersection of all argument points of a feature. This grid includes only those points that are common across all functional features, facilitating direct comparison on a shared set of points."minmax"
: Generates a grid within the range of the maximum of the minimum argument points to the minimum of the maximum argument points across features. This bounded grid encapsulates the argument point range common to all features. Note: For regular functional data this has no effect as all argument points are the same. Initial value is"union"
.
method
::character(1)
Defaults to"linear"
. One of:"linear"
: applies linear interpolation without extrapolation (seetf::tf_approx_linear()
)."spline"
: applies cubic spline interpolation (seetf::tf_approx_spline()
)."fill_extend"
: applies linear interpolation with constant extrapolation (seetf::tf_approx_fill_extend()
)."locf"
: applies "last observation carried forward" interpolation (seetf::tf_approx_locf()
)."nocb"
: applies "next observation carried backward" interpolation (seetf::tf_approx_nocb()
).
left
::numeric()
The left boundary of the window. 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.
Super classes
mlr3pipelines::PipeOp
-> mlr3pipelines::PipeOpTaskPreproc
-> mlr3pipelines::PipeOpTaskPreprocSimple
-> PipeOpFDAInterpol
Methods
Method new()
Initializes a new instance of this Class.
Usage
PipeOpFDAInterpol$new(id = "fda.interpol", param_vals = list())
Examples
task = tsk("fuel")
pop = po("fda.interpol")
task_interpol = pop$train(list(task))[[1L]]
task_interpol$data()
#> heatan h20 NIR
#> <num> <num> <tfd_reg>
#> 1: 26.7810 2.3000 [1]: (1, 0.2);(2, 0.3);(3, 0.3); ...
#> 2: 27.4720 3.0000 [2]: (1, 0.2);(2, 0.3);(3, 0.2); ...
#> 3: 23.8400 2.0002 [3]: (1, -0.05);(2, 0.05);(3, -0.08); ...
#> 4: 18.1680 1.8500 [4]: (1, -0.08);(2, -0.08);(3, 0.06); ...
#> 5: 17.5170 2.3898 [5]: (1, -0.23);(2, -0.12);(3, -0.04); ...
#> ---
#> 125: 23.8340 2.1100 [6]: (1, -0.04);(2, -0.02);(3, -0.06); ...
#> 126: 11.8050 1.6200 [7]: (1, -0.6);(2, -0.6);(3, -0.7); ...
#> 127: 8.8315 1.4200 [8]: (1, -0.7);(2, -0.8);(3, -0.8); ...
#> 128: 11.3450 1.4800 [9]: (1,-0.058);(2,-0.046);(3,-0.005); ...
#> 129: 28.9940 2.5000 [10]: (1, 0.1);(2, 0.1);(3, 0.2); ...
#> UVVIS
#> <tfd_reg>
#> 1: [1]: (1, 0.9);(2, 0.7);(3, 0.8); ...
#> 2: [2]: (1, -0.9);(2, -1.3);(3, -0.8); ...
#> 3: [3]: (1,-0.08);(2,-0.29);(3,-0.20); ...
#> 4: [4]: (1, -0.6);(2, -0.5);(3, -0.3); ...
#> 5: [5]: (1, -0.6);(2, -1.1);(3, -0.7); ...
#> ---
#> 125: [6]: (1, -0.5);(2, -0.7);(3, -0.6); ...
#> 126: [7]: (1, -1.0);(2, -0.8);(3, -1.1); ...
#> 127: [8]: (1, -0.9);(2, -0.6);(3, -1.0); ...
#> 128: [9]: (1, 0.5);(2, 0.6);(3, 0.6); ...
#> 129: [10]: (1, -0.5);(2, -1.3);(3, -0.8); ...