landmark_elastic_registration_warping#

skfda.preprocessing.registration.landmark_elastic_registration_warping(fd, landmarks, *, location=None, grid_points=None)[source]#

Calculate the transformation used in landmark registration.

Let \(t_{ij}\) the time where the sample \(i\) has the feature \(j\) and \(t^*_j\) the new time for the feature. The warping function will transform the new time in the old time, i.e., \(h_i(t^*_j)=t_{ij}\). The registered samples can be obtained as \(x^*_i(t)=x_i(h_i(t))\).

See [1] for a detailed explanation.

Parameters:
  • fd (FData) – Functional data object.

  • landmarks (ArrayLike) – List containing landmarks for each samples.

  • location (ArrayLike | None) – Defines where the landmarks will be alligned. By default it will be used as location the mean of the landmarks.

  • grid_points (Union[ArrayLike, Sequence[ArrayLike]] | None) – Grid of points where the functions are evaluated to obtain a discrete representation of the object.

Returns:

FDataGrid with the warpings function needed to register the functional data object.

Raises:

ValueError – If the object to be registered has domain dimension greater than 1 or the list of landmarks or locations does not match with the number of samples.

Return type:

FDataGrid

References

Examples

>>> from skfda.datasets import make_multimodal_landmarks
>>> from skfda.datasets import make_multimodal_samples
>>> from skfda.preprocessing.registration import (
...      landmark_elastic_registration_warping)

We will create a data with landmarks as example

>>> fd = make_multimodal_samples(n_samples=3, n_modes=2,
...                              random_state=9)
>>> landmarks = make_multimodal_landmarks(n_samples=3, n_modes=2,
...                                       random_state=9)
>>> landmarks = landmarks.squeeze()

The function will return the corresponding warping function

>>> warping = landmark_elastic_registration_warping(fd, landmarks)
>>> warping
FDataGrid(...)

The registered function can be obtained using function composition

>>> fd.compose(warping)
FDataGrid(...)

Examples using skfda.preprocessing.registration.landmark_elastic_registration_warping#

Landmark registration

Landmark registration