cupyx.scipy.spatial.distance.correlation#

cupyx.scipy.spatial.distance.correlation(u, v)[source]#

Compute the correlation distance between two 1-D arrays.

The correlation distance is defined as

\[d(u, v) = 1 - \frac{(u - \bar{u}) \cdot (v - \bar{v})}{ \|(u - \bar{u})\|_2 \|(v - \bar{v})\|_2}\]

where \(\bar{u}\) is the mean of the elements of \(u\) and \(x \cdot y\) is the dot product.

Parameters:
  • u (array_like) – Input array of size (N,)

  • v (array_like) – Input array of size (N,)

Returns:

The correlation distance between vectors u and v.

Return type:

correlation (double)