'Computes the squared Mahalanobis distances of given observations.
Parameters
observations : array-like, shape = [n_observations, n_features]
The observations, the Mahalanobis distances of the which we
compute. Observations are assumed to be drawn from the same
distribution than the data used in fit.
Returns
mahalanobis_distance : array, shape = [n_observations,]
Squared Mahalanobis distances of the observations.'

def mahalanobis(self, observations):

    precision = self.get_precision()
    centered_obs = (observations - self.location_)
    mahalanobis_dist = np.sum((np.dot(centered_obs, precision) * centered_obs), 1)
    return mahalanobis_dist
