Does anyone have any experience with MDSJ ? The following entry only gives NaN results, and I cannot understand why. The documentation is pretty rare.
import mdsj.Data;
import mdsj.MDSJ;
public class MDSJDemo {
public static void main(String[] args) {
double[][] input = {
{78.0, 60.0, 30.0, 25.0, 24.0, 7.125, 1600.0, 1.4953271028037383, 15.0, 60.0, 0.0, 0.0, 50.0},
{63.1578947368421, 51.81818181818182, 33.0, 30.0, 10.714285714285715, 6.402877697841727, 794.2857142857143, 0.823045267489712, 15.0, 20.0, 2.8571428571428568, 0.0, 75.0},
{55.714285714285715, 70.0, 16.363636363636363, 27.5, 6.666666666666666, 5.742574257425742, 577.1428571428571, 0.6542056074766355, 12.857142857142856, 10.0, 17.142857142857142, 0.0, 25.0}
};
int n=input[0].length;
double[][] output=MDSJ.classicalScaling(input);
System.out.println(Data.format(output));
for(int i=0; i<n; i++) {
System.out.println(output[0][i]+" "+output[1][i]);
}
}
}
This is the conclusion:
NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
NaN NaN
NaN NaN
NaN NaN
NaN NaN
NaN NaN
NaN NaN
NaN NaN
NaN NaN
NaN NaN
NaN NaN
NaN NaN
NaN NaN
NaN NaN
Maybe I'm using MDS incorrectly. Each 13-foot subframe is inputdesigned to represent one object, but MDSJ returns 13 points.
It also fails for this input:
double[][] input = {
{3, 4, 3},
{5, 6, 1},
{0, 1, 2}
};
EDIT: It looks like I used it wrong. I gave him this input:
Object A: {30d, 1d, 0d, 4.32, 234.1}
Object B: {45d, 3.21, 45, 91.2, 9.9}
Object C: {7.7, 93.1, 401, 0d, 0d}
But what he really wants is a distance matrix like this:
A B C
A 0 3 1
B 3 0 5
C 1 5 0
Not really, because for this input:
double[][] input = {
{0, 3, 1},
{3, 0, 5},
{1, 5, 0}
};
I get this result:
0.8713351726043931 -2.361724203891451 2.645016918006963
NaN NaN NaN
0.8713351726043931 NaN
-2.361724203891451 NaN
2.645016918006963 NaN
But if he wants an array of distances, what's the point of using MDS in the first place? I thought that he should weld an array of attributes in coordinates.