PairwiseCorrelation#

class skfda.preprocessing.registration.validation.PairwiseCorrelation(eval_points=None)[source]#

Cross-validated measure of pairwise correlation between functions.

Computes a cross-validated pairwise correlation between functions to compare registration methods [S11-5-2-2] :

\[pc=\frac{\sum_{i \neq j} \operatorname{cc}\left(\tilde{f}_{i}(t), \tilde{f}_{j}(t)\right)}{\sum_{i \neq j} \operatorname{cc}\left(f_{i}(t), f_{j}(t)\right)}\]

where \(f_i\) and \(\tilde f_i\) are the original and registered data respectively and \(cc(f, g)\) is the pairwise Pearson’s correlation between functions.

The larger the value of \(pc\), the better the alignment between functions in general.

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.

  • eval_points (NDArrayFloat | None) –

Note

Pearson’s correlation between functions is calculated assuming the samples are equiespaciated.

References

[S11-5-2-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 \
...                                                 PairwiseCorrelation
>>> 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 pairwise correlation score. >>> scorer = PairwiseCorrelation() >>> score = scorer(shift_registration, X) >>> round(score, 3) 1.816

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