[SciPy-Dev] Possibly a bug in scipy.spatial.distance.mahalanobis

Simen Langseth simlangen at gmail.com
Mon Dec 29 06:53:37 EST 2014


Dear Scipy Developers:

The documentation below mentions the following for the formula of
mahalanobis distance:

[image: \sqrt{ (u-v) V^{-1} (u-v)^T }]

http://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.spatial.distance.mahalanobis.html#scipy.spatial.distance.mahalanobis

However, in the following source code, the transpose of the delta seems to
be missing.

u = _validate_vector(u) v = _validate_vector(v)VI = np.atleast_2d(VI)delta =
u - vm = np.dot(np.dot(delta, VI), delta)return np.sqrt(m)



https://github.com/scipy/scipy/blob/6a7327e8bb8248b2ea165180bc602edf1ab33dda/scipy/spatial/distance.py

Please forgive me if I could not understand the source code perfectly.

Thanks.

Simen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20141229/76a66bd1/attachment.html>


More information about the SciPy-Dev mailing list