java cosine similarity problem

Posted by agazerboy on Stack Overflow See other posts from Stack Overflow or by agazerboy
Published on 2010-02-23T03:49:56Z Indexed on 2010/04/13 6:12 UTC
Read the original article Hit count: 516

Filed under:
|
|

Hi again :) I developed some java program to calculate cosine similarity on the basis of TF*IDF. It worked very well. But there is one problem.... :(

for example: If I have following two matrix and I want to calculate cosine similarity it does not work as rows are not same in length

doc 1
1 2 3
4 5 6

doc 2
1 2 3 4 5 6
7 8 5 2 4 9

if rows and colums are same in length then my program works very well but it does not if rows and columns are not in same length.

Any tips ???

© Stack Overflow or respective owner

Related posts about java

Related posts about math