主要步骤:
1,shingling:
把文档X截断成有位置信息的小段,长度为k。
为所有文档的每一小段分配一个整数型ID,则每一篇文档可以用高维0/1向量表示,其中有很多0.
2,Min-Hash
把高维向量转换成低维签名。
通过Min-Hash的方法,先随机生成100个排列Pi,通过Min-Hash,将文档用100维向量表示。
如?
Define a “hash” function hπ(C) = the index of
the first (in the permuted order π) row in
which column C has value 1:
hπ
(C) = minπ π(C)
![相似文档匹配 - Eric - hacktimelin的博客 相似文档匹配 - Eric - hacktimelin的博客](http://img1.ph.126.net/u6WsjWtMQyJPnX1bVLrR1Q==/6608551966585057609.jpg)
3.通过Locallity-Sensitive Hashing
将低维签名,切成b段,每段r行。对每一个段,进行一次哈希。相似文档将被哈希到相同的桶中。至少在同一个桶中出现的文档则被列为相识文档。其相识度通过:“
? Columns C1 and C2 have similarity t
? Pick any band (r rows)
? Prob. that all rows in band equal = t^r
? Prob. that some row in band unequal = 1 - t^r
? Prob. that no band identical = (1 - t^r
)b
? Prob. that at least 1 band identical =
1 - (1 - t^r
)^b