次元が高い場合に関してのsimhashの計算

最近simhashの実装を行っていて、データの次元が高いとsimhashを計算するのに必要なランダムなベクトルをメモリ上に乗らないという事態が生じたのでad hocな方法で回避していたけど、論文[1]をよく見直すとほぼ同じ方法でより計算コストが少ない方法が紹介してあったので少し解説を行ってみる。ちなみに以下の解説では低次元のビットベクトルに縮約した後にハミング距離が近いものをどうやって探索するかについては述べないです、それに関しては[1],[2]を参照してください。

ちなみに自分が実装したのは各ビットごとに次元に対するハッシュ関数を定義して計算する方法でした。この方法だと以下で開設する手法よりもf倍の回数ハッシュ関数を計算する必要があるので実行時間が割とかかる。

解説


simhash[3](LSH[2])([1]64bit)

web

Dxfsimhash


(一)fDr_i(i = 1...f)

(二)xr_i

(三)B

B_i = > 01otherwise 0



Dxysimhashvwxyvw[2][3]

DfD
[1]


(一)xihf bit

(二)fV0

(三)for i \in x 

(一)H = h(i)

(二)for j \in (0..f)

H[j]1V[j] += x[i]V[j] -= x[i]



(四)Vsimhash


D=3f=2010101211x=(3.0 , 2.0 , 4.0)V
V[0] = 3.0 - 2.0 + 4.0 = 7.0
V[1] = - 3.0 + 2.0 + 4.0 = 3.0

simhash11

r_i
(1.0 , -1.0 , 1.0)
(-1.0 , 1.0 , 1.0)



simhashD使



[1] Gurmeet Singh Manku Arvind Jain and Anish Das Sarma "Detecting near-duplicates for web crawling" Proceedings of the 16th international conference on World Wide Web, 2007

[2] Deepak Ravichandran  Patrick Pantel and Eduard Hovy "Randomized algorithms and NLP: using locality sensitive hash function for high speed noun clustering" Proceedings of the 43rd Annual Meeting on Association for Computational Linguistics2005

[3] Moses S. Charikar"Similarity estimation techniques from rounding algorithms"Proceedings of the thiry-fourth annual ACM symposium on Theory of computing2002