Here's a relevant snippet:
[junit] Testcase:
testAsFormatString(org.apache.mahout.matrix.TestSparseVector):
FAILED
[junit] format expected:<[s5, [2:2.2, 1:1.1], 3:3.3, ] > but
was:<[s5, [1:1.1, 2:2.2], 3:3.3, ] >
[junit] junit.framework.ComparisonFailure: format expected:<[s5,
[2:2.2, 1:1.1], 3:3.3, ] > but was:<[s5, [1:1.1, 2:2.2], 3:3.3, ] >
[junit] at
org.apache.mahout.matrix.TestSparseVector.testAsFormatString(TestSparseVector.java:40)
I've seen this happen in some of my dev environments but not others.
The error is because the serialized vector/matrix has transposed some
of the elements relative to what the unit test expects. It looks to
me like this is caused by iterating over the keyset directly rather
than sorting it first:
SparseVector.java:97
-------------------------
public String asFormatString() {
StringBuilder out = new StringBuilder();
out.append("[s").append(cardinality).append(", ");
for (Integer index : values.keySet())
out.append(index).append(':').append(values.get(index)).append(", ");
out.append("] ");
return out.toString();
}
-------------------------
-Allen