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.
The parameters are the parameters inherited from PipeOpTaskPreprocSimple
,
as well as the following parameters:
grid
:: character(1)
| numeric()
The grid to use for interpolation.
If grid
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, requires left
and right
to be specified in the latter case.
If grid
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 (see tf::tf_approx_linear()
).
"spline"
: applies cubic spline interpolation (see tf::tf_approx_spline()
).
"fill_extend"
: applies linear interpolation with constant extrapolation (see tf::tf_approx_fill_extend()
).
"locf"
: applies "last observation carried forward" interpolation (see tf::tf_approx_locf()
).
"nocb"
: applies "next observation carried backward" interpolation (see tf::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.
mlr3pipelines::PipeOp
-> mlr3pipelines::PipeOpTaskPreproc
-> mlr3pipelines::PipeOpTaskPreprocSimple
-> PipeOpFDAInterpol
new()
Initializes a new instance of this Class.
PipeOpFDAInterpol$new(id = "fda.interpol", param_vals = list())
id
(character(1)
)
Identifier of resulting object, default "fda.interpol"
.
param_vals
(named list
)
List of hyperparameter settings, overwriting the hyperparameter settings that would
otherwise be set during construction. Default list()
.
clone()
The objects of this class are cloneable with this method.
PipeOpFDAInterpol$clone(deep = FALSE)
deep
Whether to make a deep clone.
task = tsk("fuel")
pop = po("fda.interpol")
task_interpol = pop$train(list(task))[[1L]]
task_interpol$data()
Run the code above in your browser using DataLab