Viewing a single comment thread. View all comments

Competitive_Dog_6639 t1_j30hjmd wrote

The situation you are describing is not possible in theory. If a matrix is PSD and invertible, it must be positive definite. And the inverse of a positive definite matrix is also positive definite, which means it must only yield positive Mahalonois distances (or zero if the vectors are identical). https://math.stackexchange.com/questions/2288067/inverse-of-a-symmetric-positive-definite-matrix

In practice, this might happen due to small eigenvalues and numerical error. The easiest fix is to add the identity scaled by a small constant, like in ridge regression, as others suggest

3

eiliya_20 OP t1_j30sx8w wrote

Yeah, your right but unfortunately I'm not getting the expected result as described above.

1