spearmanr_d#

mvpy.math.spearmanr_d(x: ndarray | Tensor, y: ndarray | Tensor, *args: Any) ndarray | Tensor[source]#

Compute Spearman distance between x and y. Note that distances are always computed over the final dimension in your inputs.

Parameters:
xUnion[np.ndarray, torch.Tensor]

Matrix to compute distance with.

yUnion[np.ndarray, torch.Tensor]

Matrix to compute distance with.

Returns:
Union[np.ndarray, torch.Tensor]

Spearman distances.

Notes

Spearman distances are defined as \(1 - \text{spearmanr}(x, y)\).

Examples

>>> import torch
>>> from mvpy.math import spearmanr
>>> x = torch.tensor([1, 5, 9])
>>> y = torch.tensor([1, 50, 60])
>>> spearmanr_d(x, y)
tensor(0., dtype=torch.float64)