landmark_elastic_registration#

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

Perform landmark registration of the curves.

Let \(t_{ij}\) the time where the sample \(i\) has the feature \(j\) and \(t^*_j\) the new time for the feature. The registered samples will have their features aligned, i.e., \(x^*_i(t^*_j)=x_i(t_{ij})\).

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. In case of objects with multidimensional domain a list axis with points of evaluation for each dimension.

Returns:

FDataGrid with the functional data object registered.

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,
... )
>>> from skfda.representation.basis import BSplineBasis

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 registered curves

>>> landmark_elastic_registration(fd, landmarks)
FDataGrid(...)

This method will work for FDataBasis as for FDataGrids

>>> fd = fd.to_basis(BSplineBasis(n_basis=12))
>>> landmark_elastic_registration(fd, landmarks)
FDataGrid(...)

Examples using skfda.preprocessing.registration.landmark_elastic_registration#

Landmark registration

Landmark registration