scipy.spatial.distance.mahalanobis

scipy.spatial.distance.mahalanobis(u, v, VI)[source]

Computes the Mahalanobis distance between two n-vectors u and v, which is defined as

\sqrt{ (u-v) V^{-1} (u-v)^T }

where V is the covariance matrix. Note that the argument VI is the inverse of V.

Parameters :

u : ndarray

An n-dimensional vector.

v : ndarray

An n-dimensional vector.

VI : ndarray

The inverse of the covariance matrix.

Returns :

d : double

The Mahalanobis distance between vectors u and v.

Previous topic

scipy.spatial.distance.kulsinski

Next topic

scipy.spatial.distance.matching