SobolevLeastSquares#

class skfda.preprocessing.registration.validation.SobolevLeastSquares[source]#

Cross-validated measure of the registration procedure.

Computes a cross-validated measure of the level of synchronization [S11-5-2-3]:

\[sls=1 - \frac{\sum_{i=1}^{N} \int\left(\tilde{f}_i'(t)- \frac{1}{N} \sum_{j=1}^{N} \tilde{f}_j'\right)^{2} dt} {\sum_{i=1}^{N} \int\left(f_i'(t)-\frac{1}{N} \sum_{j=1}^{N} f_j'\right)^{2} dt}\]

where \(f_i'\) and \(\tilde{f}_i'\) are the derivatives of the original and the registered data respectively.

This criterion measures the total cross-sectional variance of the derivatives of the aligned functions, relative to the original value. A value of \(1\) would indicate an identical shape for all registered curves, while zero corresponds to no improvement in the registration. It can be negative because the model can be arbitrarily worse.

Attributes:

eval_points (array_like, optional) – Set of points where the functions are evaluated to obtain a discrete representation and perform the calculation.

Parameters:
  • estimator (RegistrationTransformer) – Registration transformer.

  • X (FData) – Original functional data.

  • y (FData) – Registered functional data.

Note

The original sobolev least square measure used in [S11-5-2-3] is defined as \(1 - sls\), but has been modified according to the scikit-learn scorers, where higher values correspond to better cross-validated measures.

References

[S11-5-2-3] (1,2)

Srivastava, Anuj et. al. Registration of Functional Data Using Fisher-Rao Metric (2011). In Comparisons with other Methods (p. 18). arXiv:1103.3817v2.

Examples

Calculate the score of the shift registration of a sinusoidal process synthetically generated.

>>> from skfda.preprocessing.registration.validation import \
...                                                 SobolevLeastSquares
>>> from skfda.preprocessing.registration import (
...     LeastSquaresShiftRegistration,
... )
>>> from skfda.datasets import make_sinusoidal_process
>>> X = make_sinusoidal_process(error_std=0, random_state=0)

Fit the registration procedure.

>>> shift_registration = LeastSquaresShiftRegistration()
>>> shift_registration.fit(X)
LeastSquaresShiftRegistration(...)

Compute the sobolev least squares score. >>> scorer = SobolevLeastSquares() >>> score = scorer(shift_registration, X) >>> round(score, 3) 0.924

Methods

score_function(X, y)

Compute the score of the transformation performed.

score_function(X, y)[source]#

Compute the score of the transformation performed.

Parameters:
  • X (FData) – Original functional data.

  • y (FData) – Functional data registered.

Returns:

Score of the transformation.

Return type:

float