I changed LMNN (Largest Margin Nearest Neighbor) metric learning algorithm matlab code to java, and use Jama library. I got different result, The difference occurred, I think because of the eigenValue decomposition (eigenvalue and eigenvector) in Matlab and Jama. Would you please comment me if you encountered such problem before. In addition, is it must to get similar result under such condition.
In Matlab:
[V, L] = eig(M);
Java ( IdeM is PSD matrix)
Matrix V = ideM.eig().getV();
Matrix L = ideM.eig().getD();
Results
Example results:
A = [2 4 2; 6 8 1; 5 7 5]
Matlab result:
>> [V,L] = eig(A)
V =
-0.3486 -0.82756 0.19221
-0.57978 0.56013 -0.40315
-0.73643 0.037403 0.89472
L =
12.878 0 0
0 -0.7978 0
0 0 2.92
Java using Jama Library:
[[0.8275575078346545, -0.3493113857121139, 0.24597790205308678],
[-0.5601335729999509, -0.5809634522691761, -0.5159207870175849],
[-0.037402561741212, -0.7379374514853343, 1.144995023469712]]
[[-0.7977988158677061,0.0, 0.0],
[0.0, 12.877769427129202, 0.0],
[0.0, 0.0,2.9200293887385067]]