# Is Wishart distance always positive?

From what is told on page 268 of the Polarimetric Radar Imaging: From Basics To Applications: I have written the following code for wishart distance calculation in Matlab:

function distance = WishartDistance(Cm,Z)
distance = log(det(Cm))+trace(Cm\Z);
end


But for matrices $C_m$ and $Z$ in the following:

$$-8.2715$$

I want to see if the formula should be written as

$$d_3(Z,\omega_m)=|\ln|C_m|+\text{Tr}(C_m^{-1}Z)|$$

Or is an absolute value omitted in the book incorrectly?

• I don't know this field at all, but I think that d is the log of a distance measure that's always positive. Look at the paragraph above Eq. 8.11 - they start with a measure based on the Wishart PDF (which is always positive), then they take the log to get the "distance" function. This isn't a distance in the sense of a distance metric, but I guess they just want to know whether distances increase or decrease to classify - so the log transform is fine. – AJK Oct 1 '17 at 17:20
• Basically, I think the book's equation is correct, and it is OK that d_3 is negative, and the only problem is that calling it a "distance" rather than a "score" or something similar is a little confusing. – AJK Oct 1 '17 at 17:24
• p. 2 of cv.tu-berlin.de/fileadmin/fg140/Clustering_by_deterministic.pdf : "In  a distance measure ... was developed based on the Wishart distribution. Unfortunately this distance measure is not a metric, because it is neither homogeneous, nor symmetric and does not fullfill the triangle inequality." Nonetheless this distance measure is often used and showed its effectiveness in practice. Because of this and its direct relation to the density function it will be also used in this work. – Mark L. Stone Oct 1 '17 at 19:06
• so @MarkL.Stone it says that in spite of not being a real metric but it is effective and so the classification results should be good. But in my case, I get really incorrect classification results and I really don't understand why? – Sepideh Abadpour Oct 1 '17 at 19:45
• Just to be clear, the end quote in my comment should have been at the end of the comment. The claim "showed its effectiveness in practice" was made by the authors of the article I linked, not by me. I agree it's not a distance metric, despite its name. I have nothing to offer regarding its effectiveness. – Mark L. Stone Oct 1 '17 at 19:52

Can any sensible distance measure be negative? No.

Consider this. Can you have a distance that is closer than zero? If you do then what is the meaning of it?

The beginning of the page 268 from your book describes how they got the distance measure: it's based on the natural log of the probability density. The density is based on Wishart distribution. When a matrix Z is close to matrix C, the probability density is high, and this probability density is low when C is not similar to Z.

So, for low probabilities, the log will be negative, making your measure become negative too. Hence, this measure is not a good distance. Apparently, it's still good enough for the classifier that is used in this domain.

A good distance measure will have several properties including non-negativity and triangle inequality.

• This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. You can also add a bounty to draw more attention to this question. - From Review – Ferdi Oct 1 '17 at 17:05
• @Ferdi this answers OP's question. I'm not sure yoy what you mean. – Aksakal Oct 1 '17 at 17:10
• I know it can't be but consider two matrices $A=\begin{bmatrix}0.75 & 0 & 0\\0 & 0.5 0\\0 & 0 & 0.25\end{bmatrix}$ and $B=\begin{bmatrix}0.5 & 0 & 0\\0 & 0.25 0\\0 & 0 & 0.125\end{bmatrix}$ both of them are positive definite. then surely we will have $|A|=0.09375$ and $\ln|A|=-2.3671$ and $A^{-1}B=\begin{bmatrix}0.66 & 0 & 0\\0 & 0.5 0\\0 & 0 & 0.5\end{bmatrix}$ and $\text{Tr}(A^{-1}B)=1.66$ and we will have $\ln|A|+\text{Tr}(A^{-1}B)=-2.3671+1.66=-0.7071\lt 0$. I mean it seems that either the formula in the book is incorrect or I am doing something wrong – Sepideh Abadpour Oct 1 '17 at 17:15
• Perhaps edit your new example into the question? – mdewey Oct 1 '17 at 20:47
• @sepideh, the formula is correct only because it's the one used in this domain. They call thing thing a distance measure. I bet it's because it's not a sensible distance. It doesn't have any features of the distance, such as subadditivity. It's something that can be used in this classifier – Aksakal Oct 2 '17 at 3:13