lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefy D." <tsuki_st...@yahoo.com>
Subject Dimension mismatch exception
Date Thu, 20 Mar 2014 21:04:47 GMT
Dear all,

I am trying to compute the cosine similarity between several documents. I have an indexed
directory A made using 10000 files and another indexed directory B made using 20000 files.
All the indexed documents from both directories have the same length (100 sentences). I want
to get the cosine similarity between documents from directory A and documents from directory
B. I have used the code from here but on the two indexed directories. So I use something like
getCosineSimilarity(docs_A[i], docs_B[j]);

I get the following error:
Exception in thread "main" org.apache.commons.math3.exception.DimensionMismatchException:
44,375 != 596,263
    at org.apache.commons.math3.linear.RealVector.checkVectorDimensions(RealVector.java:179)
    at org.apache.commons.math3.linear.RealVector.checkVectorDimensions(RealVector.java:165)
    at org.apache.commons.math3.linear.RealVector.dotProduct(RealVector.java:307)
    at NewApp.testCosine.getCosineSimilarity(testCosine.java:57)

Please help me. Thank you very much!

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message