Closed
Description
The Mahalanobis distance is correctly defined in https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/neighbors/dist_metrics.pyx#L623. However, the mahalanobis method of covariance.EmpiricalCovariance https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/covariance/empirical_covariance_.py#L258 is wrong for two reasons:
- The current implementation returns the square of the distance. The np.sqrt function must be applied on the current result in order to get the true distance.
- The docs say "the provided observations are assumed to be centered". Yet, the opposite is true, since the observations are being centered inside the method, and the user should not be centering the observations.
Thanks for fixing these and making the relevant changes to the dependent examples.