title: Mahout rowSimilarity
body: <p>I am trying to compute row similarity between wikipedia documents. I have the tf-idf vectors in format <code>Key class: class org.apache.hadoop.io.Text Value Class: class org.apache.mahout.math.VectorWritable</code>. I am following the quick tour of text analysis from here: <a href="https://cwiki.apache.org/confluence/display/MAHOUT/Quick+tour+of+text+analysis+using+the+Mahout+command+line" rel="nofollow">https://cwiki.apache.org/confluence/display/MAHOUT/Quick+tour+of+text+analysis+using+the+Mahout+command+line</a></p>
  
  <p>I created a mahout matrix as follows:</p>
  
  <pre><code>mahout rowid \
     -i wikipedia-vectors/tfidf-vectors/part-r-00000
     -o wikipedia-matrix
  </code></pre>
  
  <p>I got the the number generated rows and columns:</p>
  
  <pre><code>vectors.RowIdJob: Wrote out matrix with 4587604 rows and 14121544 columns to wikipedia-matrix/matrix
  </code></pre>
  
  <p>The matrix is of format <code>Key class: class org.apache.hadoop.io.IntWritable Value Class: class org.apache.mahout.math.VectorWritable</code></p>
  
  <p>I also have a <code>docIndex</code> document with the following format: <code>Key class: class org.apache.hadoop.io.IntWritable Value Class: class org.apache.hadoop.io.Text</code></p>
  
  <p>Then when I run the rowsimilarity job</p>
  
  <pre><code>mahout rowsimilarity 
     -i wikipedia-matrix/matrix 
     -o wikipedia-similarity 
     -r 4587604
     --similarityClassname SIMILARITY_COSINE
     -m 50
     -ess
  </code></pre>
  
  <p>I am getting the following error:</p>
  
  <pre><code>13/08/25 15:18:18 INFO mapred.JobClient: Task Id : attempt_201308161435_0364_m_000001_1, Status : FAILED
  java.lang.ClassCastException: org.apache.hadoop.io.Text cannot be cast to org.apache.mahout.math.VectorWritable
      at org.apache.mahout.math.hadoop.similarity.cooccurrence.RowSimilarityJob$VectorNormMapper.map(RowSimilarityJob.java:183)
      at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:144)
      at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:648)
      at org.apache.hadoop.mapred.MapTask.run(MapTask.java:322)
      at org.apache.hadoop.mapred.Child$4.run(Child.java:266)
      at java.security.AccessController.doPrivileged(Native Method)
      at javax.security.auth.Subject.doAs(Subject.java:396)
      at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1278)
      at org.apache.hadoop.mapred.Child.main(Child.java:260)
  </code></pre>
  
  <p>Could someone please help me with the error? I am not sure from where is this  <code>org.apache.hadoop.io.Text</code> when the input matrix is of format <code>Key class: class org.apache.hadoop.io.IntWritable Value Class: class org.apache.mahout.math.VectorWritable</code></p>
  
  <p>Thank you very much.</p>
  
  <p>Best,
  Dragan</p>