我正在使用TF/IDF来计算相似度。例如,如果我有以下两个文档。tf idf相似度
Doc A => cat dog
Doc B => dog sparrow
这是正常的它的相似性是50%,但是当我计算它的TF/IDF。它是作为按照
TF值文件甲
dog tf = 0.5
cat tf = 0.5
TF为文件B值
dog tf = 0.5
sparrow tf = 0.5
进行DOC
IDF值甲
dog idf = -0.4055
cat idf = 0
IDF值文件乙
dog idf = -0.4055 (without +1 formula 0.6931)
sparrow idf = 0
TF为文件/ IDF值A
0.5x-0.4055 + 0.5x0 = -0.20275
TF/IDF值文件乙
0.5x-0.4055 + 0.5x0 = -0.20275
现在看起来像有-0.20275相似。是吗? 或者我错过了什么? 或者是下一步的任何一种?请告诉我,我也可以计算出来。
我用TF/IDF公式,维基百科提到
您是否在使用Apache Mahout来计算它?如果是的话,请让我知道需要采取的步骤。我必须开发一个原型来使用Apache Mahout来计算TF IDF。 junaid_surqyahoo.co.in – 2012-01-04 10:16:44