cupyx.scipy.spatial.distance.correlation#

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

计算两个一维数组之间的相关距离。

相关距离定义为

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

其中 \(\bar{u}\)\(u\) 中元素的平均值,\(x \cdot y\) 是点积。

参数
  • u (array_like) – 大小为 (N,) 的输入数组

  • v (array_like) – 大小为 (N,) 的输入数组

返回

向量 uv 之间的相关距离。

返回类型

correlation (double)