Hi all,

I hope this is the right place to ask questions. If not I am sorry, but it would be nice to direct me to the right place then.

So my question is about the unit tests. Currently I am implementing a simple gaussian classifier. Besides the class prior probabilities, this implementation also outputs the respective mean values, determinants, and covariance matrices, respectively their inverses.

Now I face the problem, that the values of my SystemDS implementation and my R implementation are quite off for random generated test matrices. I assume that this is due to floating point errors / floating point precision. At first glance they look quite similar, but since it outputs scientific notation, one can clearly see that the magnitude by which they are off is quite a lot. E.g. for my determinant comparison I got the following:

(1,1): 1.2390121975770675E14 <--> 1.2390101941279517E14
(3,1): 1.510440018532407E85 <--> 1.5104388050968705E85
(2,1): 1.6420264128994816E38 <--> 1.6420263615987703E38
(5,1): 8.881025000211518E70 <--> 8.881037540234089E70
(4,1): 1.7888589555748764E22 <--> 1.78885700537877E22

I face similar issues with the inverses of my covariance matrices.

Since I use the eigenvalues and eigenvectors for calculating the determinant and the inverse in SystemDL, I already compared them to the eigenvalues and vectors which R computes, and already there, differences (due to floating point differences) are observable.

My question would be now, how to test, respectively compare such matrices and vectors? It seems a bit odd to me, to set the tolerance to something like "2.0E80" or so.

Would be great if someone could help me out!

Best,
Kevin

Reply via email to