mvpa2.clfs.distance.mahalanobis_distance

mvpa2.clfs.distance.mahalanobis_distance(x, y=None, w=None)

Calculate Mahalanobis distance of the pairs of points.

Parameters:

`x`

first list of points. Rows are samples, columns are features.

`y`

second list of points (optional)

`w` : np.ndarray

optional inverse covariance matrix between the points. It is computed if not given

Inverse covariance matrix can be calculated with the following

w = np.linalg.solve(np.cov(x.T), np.identity(x.shape[1]))

or

w = np.linalg.inv(np.cov(x.T))