Skip to main content

pairwise_correlation_score

Function pairwise_correlation_score 

Source
pub fn pairwise_correlation_score(
    registered: &FdMatrix,
    argvals: &[f64],
) -> Result<f64, FdarError>
Expand description

Compute the pairwise correlation registration score: mean functional Pearson correlation over all n(n−1)/2 unordered curve pairs.

Formula: mean over (i<k) of [⟨f̃ᵢ, f̃_k⟩_L2 / (‖f̃ᵢ‖_L2 · ‖f̃_k‖_L2)]

where f̃ᵢ = fᵢ − μᵢ is the mean-centred curve, μᵢ = ∫ fᵢ dt / ∫ dt is the Simpson-weighted functional mean, and all inner products and norms are Simpson-weighted. This is the functional analogue of Pearson correlation (centred), not cosine similarity (uncentred).

A zero-variance curve (‖f̃ᵢ‖ ≈ 0, i.e. a nearly constant curve) contributes 0 to every pair it participates in (NaN guard).

Higher scores indicate greater pairwise alignment — use this score to confirm that registration has increased curve-to-curve similarity.

§Standalone form

This computes the mean Pearson correlation of the registered curves directly, without dividing by the correlation of the unregistered curves. This diverges from scikit-fda’s PairwiseCorrelation scorer which returns a ratio.

§Complexity

O(n² · m) — suitable for moderate n (e.g., n ≤ 500 with m ≤ 1000).

§Returns Result

Returns Result<f64, FdarError> to surface dimension/parameter validation errors, consistent with the other FEAT-07 score functions.

§Arguments

  • registered — Registered functional data (n × m), n ≥ 2
  • argvals — Evaluation points (length m, at least 2)

§Errors