Solved – version of the Mahalanobis distance for matrices

I'm working on a computer vision problem and I want to use the Mahalanobis distance to cluster image patches (2D matrices having the same dimensions). I haven't been able to find any generalisation up to this point and would prefer not to vectorise my patches and end-up with a huge covariance matrix.

Since the exponent term in the multivariate Gaussian distribution density function is related to the Mahalanobis distance, I looked for a matrix version and I found the Matrix normal distribution:

The probability density function for the random matrix $mathbf{X}(ntimes p)$ that follows the matrix normal distribution $mathcal{MN}_{n,p}(mathbf{M}, mathbf{U}, mathbf{V})$ has the form:

$p(mathbf{X}midmathbf{M}, mathbf{U}, mathbf{V}) = frac{expleft( -frac{1}{2} , mathrm{tr}left[ mathbf{V}^{-1} (mathbf{X} – mathbf{M})^{T} mathbf{U}^{-1} (mathbf{X} – mathbf{M}) right] right)}{(2pi)^{np/2} |mathbf{V}|^{n/2} |mathbf{U}|^{p/2}}

where $mathrm{tr}$ denotes trace and $mathbf{M}$ is $ntimes p$, $mathbf{U}$ is $ntimes n$ and $mathbf{V}$ is $ptimes p$.

Now, my question is : is the trace term a generalisation of the Mahalanobis distance applied on matrices or is there another formulation ?

No. There are metrics that try to build on a similar concept using Wishart distribution. I have seen papers in MRI imaging that use the metrics. See p.16 in this slide deck:

There's a distance called Riemannian metric for positive definite matrices, that I used in the past to measure the distance of covariance matrices. For instance, look at Eq.13 here: "Classification of covariance matrices using a Riemannian-based kernel for BCI applications", Alexandre Barachant, Stéphane Bonnet, Marco Congedo, Christian Jutten. I just grabbed the first link in Google, this is not the reference paper on the subject

Similar Posts:

Rate this post

Leave a Comment