I am using the Smile MDS
https://github.com/haifengl/smile/blob/master/core/src/main/java/smile/mds/MDS.java and occasionally running into:
Caused by: java.lang.IllegalArgumentException:
Some of the first 2 eigenvalues are < 0
The data being sent in is a square symmetric distance matrix. I have not put any restrictions on the distance matrix values except they must be nonnegative - which in fact all are between 0 and 1 inclusive.
So two questions:
- under what conditions may such a (nonnegative) matrix result in negative eigenvalues?
- how might I condition the input similarities matrix to avoid the negative values?
- (extra credit): are there other JVM libraries that might help to deal with the existing (arbitrary non-negative) dataset as is?
Update
The diagonal of the distance matrix is all zeros.