private Matrix getTransposedMatrix(Instances data) {
double[][] temp = new double[data.numAttributes()][data.numInstances()];
for (int i = 0; i < data.numInstances(); i++) {
Instance inst = data.instance(i);
for (int v = 0; v < inst.numValues(); v++) {
temp[inst.index(v)][i] = inst.valueSparse(v);
}
}
Matrix My_x = new Matrix(temp);
return My_x;
}