

def mahalanobis_distance(self, samples, subtract_mean=True, square_root=False):
    '\n        Compute the mahalanobis distance given a sample :math:`\\mathbf{x}` or an\n        array of samples :math:`\\mathbf{X}`, i.e.\n\n        .. math::\n           \\sqrt{(\\mathbf{x}-\\boldsymbol{\\mu})^T \\mathbf{Q} (\\mathbf{x}-\\boldsymbol{\\mu})}\n           \\text{ or }\n           \\sqrt{(\\mathbf{X}-\\boldsymbol{\\mu})^T \\mathbf{Q} (\\mathbf{X}-\\boldsymbol{\\mu})}\n\n        Parameters\n        ----------\n        samples : `ndarray`\n            A single data vector or an array of multiple data vectors.\n        subtract_mean : `bool`, optional\n            When ``True``, the mean vector is subtracted from the data vector.\n        square_root : `bool`, optional\n            If ``False``, the mahalanobis distance gets squared.\n        '
    (samples, _) = square_root._data_to_matrix(samples, None)
    if (len(samples.shape) == 1):
        samples = samples[(..., None)].T
    return self._mahalanobis_distance(samples=samples, subtract_mean=subtract_mean, square_root=square_root)

dataset/ETHPy150Open menpo/menpo/menpo/model/gmrf.py GMRFVectorModel.mahalanobis_distance/VarMisuse@28/316 `self`->`square_root`