mahout-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Grant Ingersoll <gsing...@apache.org>
Subject A Bunch of Vector questions
Date Tue, 09 Jun 2009 21:49:06 GMT
I'm looking into the whole labels thing as well as Vector stuff and  
I'm confused by a couple of things.

1. DirchletMapper assumes DenseVector implementation, no?  Line 45?

2. Shouldn't DenseVector implement equals like SparseVector does?

3. VectorView doesn't appear to implement asFormatString consistently  
with the other Vectors.  Adding:
private static void doTestVectors(Vector left, Vector right) {
     left.setQuick(0, 1);
     left.setQuick(1, 2);
     left.setQuick(2, 3);
     right.setQuick(0, 4);
     right.setQuick(1, 5);
     right.setQuick(2, 6);
     double result = left.dot(right);
     assertEquals(result + " does not equal: " + 32, 32.0, result);
     String formattedString = left.asFormatString();
     System.out.println("Vec: " + formattedString);
     Vector vec = AbstractVector.decodeVector(formattedString);
     assertTrue("vec is null and it shouldn't be", vec != null);
     assertTrue("Vector could not be decoded from the formatString",  
vec.equals(left));
   }

to VectorTest causes a failure for the VectorView test stuff.   
Shouldn't it output the format in a manner consistent with the  
underlying implementation?  Thus, if it is a DenseVector, then it  
outputs that type, else if it is a Sparse it outputs the sparse type.

Thoughts?

-Grant

Mime
View raw message