cupyx.scipy.spatial.distance.jensenshannon#

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

Compute the Jensen-Shannon distance between two 1-D arrays.

The Jensen-Shannon distance is defined as

\[d(u, v) = \sqrt{\frac{KL(u \| m) + KL(v \| m)}{2}}\]

where \(KL\) is the Kullback-Leibler divergence and \(m\) is the pointwise mean of u and v.

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

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

Returns:

The Jensen-Shannon distance between vectors u and v.

Return type:

jensenshannon (double)