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_r2¶
- nidl.metrics.procrustes_r2(X, Y)[source]¶
Procrustes similarity between two point clouds / embeddings in the Euclidean case, when scale matters.
Computes the least squares solution for the regression problem Y = ΩX + b where Ω is orthogonal, b is a constant vector. Returns the (variance-weighted) r^2 of the best fit.
- 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
R^2 score in (-∞, 1]. 1 means that X and Y are identical up to translation + orthogonal transform.
Notes
This metric is not symmetric, procrustes_r2(X, Y) != procrustes_r2(Y, X) in general.
References