Note

This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the user guide for the big picture.

nidl.metrics.procrustes_similarity

nidl.metrics.procrustes_similarity(X, Y)[source]

Procrustes similarity between two point clouds / embeddings in the Euclidean case, with global scale invariance.

Computes the least squares solution for the regression problem Y = sΩX + b where Ω is orthogonal, b is a constant vector and s a global scaling parameter. Returns the Frobenius cosine between Ŷ = sXΩ+b and Y, i.e. the quantity ⟨Y,Ŷ⟩/‖Y‖⋅‖Ŷ‖ where ⟨⋅,⋅⟩ is the Frobenius inner product of matrices and ‖⋅‖ the associated Frobenius norm.

Parameters:
Xtorch.Tensor or array-like, shape (n_samples, d1)
Ytorch.Tensor or array-like, shape (n_samples, d2)
Returns:
sim0-dim torch.Tensor or np.ndarray

In [0, 1]. 1 means that X and Y are identical up to translation + orthogonal transform + global scaling.

References

https://en.wikipedia.org/wiki/Orthogonal_Procrustes_problem