SciPy

This is documentation for an old release of SciPy (version 1.0.0). Search for this page in the documentation of the latest stable release (version 1.15.1).

scipy.spatial.distance.wminkowski

scipy.spatial.distance.wminkowski(u, v, p, w)[source]

Computes the weighted Minkowski distance between two 1-D arrays. The weighted Minkowski distance between u and v, defined as

\[\left(\sum{(|w_i (u_i - v_i)|^p)}\right)^{1/p}.\]
Parameters:

u : (N,) array_like

Input array.

v : (N,) array_like

Input array.

p : int

The order of the norm of the difference \({||u-v||}_p\).

w : (N,) array_like

The weight vector.

Returns:

wminkowski : double

The weighted Minkowski distance between vectors u and v.

Notes

wminkowski is DEPRECATED. It implements a definition where weights are powered. It is recommended to use the weighted version of minkowski instead. This function will be removed in a future version of scipy.