3. ジャッカード類似度 (3.1章)�
• 「どれぐらい似ているか」を表す指標:
ジャッカード類似度 = | S ∩ T | / | S ∪ T |�
3(C) Recruit Communications Co.,Ltd. All rights reserved. �
3.1.1 Jaccard Similarity of Sets
The Jaccard similarity of sets S and T is |S ∩ T |/|S ∪ T |, that is, the ratio
of the size of the intersection of S and T to the size of their union. We shall
denote the Jaccard similarity of S and T by SIM(S, T).
Example 3.1 : In Fig. 3.1 we see two sets S and T . There are three elements
in their intersection and a total of eight elements that appear in S or T or both.
Thus, SIM(S, T) = 3/8. ✷
T
S
Figure 3.1: Two sets with Jaccard similarity 3/8
4. Minhashing (3.3章)�
• 想定する状況
– 文章 A, B, C, D がある
– 単語 a, b, c, d, e が含まれるかで 0 or 1 つけた
– 文章のジャッカード類似度を計算したい�
4(C) Recruit Communications Co.,Ltd. All rights reserved. �
A� B� C� D�
a� 1� 0� 0� 1�
b� 0� 0� 1� 0�
c� 0� 1� 0� 1�
d� 1� 0� 1� 1�
e� 0� 0� 1� 0�
17. LSH のアルゴリズム�
• Minhashing した ハッシュ-文章表がある
• ある文章 A と似た文章を探したい
• ハッシュを、r 個毎の b 個のグループに分ける
• ハッシュとして、
「r 個のうち全部が A と同じなら残す」
というものを使う
• これを b 回それぞれのグループで行って、
残ったものの和集合を「A に似た文章の候補」
として、後はその中で類似度を真面目に計算
するとかする
17(C) Recruit Communications Co.,Ltd. All rights reserved. �
18. LSHの評価�
• 文章 A と最も良く似ている文章 B との類似度
は s だったとする
• 最初のグループで、AとBが全部同じ確率は
sr
• 逆に言えば、最初のグループでBが選ばれな
い確率(false negative:偽陰性)は、1-sr
• b 個のグループ全部で B が選ばれない確率
(false negative)は、(1-sr)b
• っていうことは、Bが候補に選ばれる確率は、
1-(1-sr)b
18(C) Recruit Communications Co.,Ltd. All rights reserved. �
19. S字カーブ�
• r と b の数を適当に仮定してシミュレートした
結果が、下の図
• LSH は、ある程度類似度が大きいものを探す
のに効果的な手法であることが分かる�
19(C) Recruit Communications Co.,Ltd. All rights reserved. �
90 CHAPTER 3. FINDING SIMILAR ITEMS
0 1
of documents
Jaccard similarity
Probability
of becoming
a candidate
Figure 3.7: The S-curve
20. S字カーブを計算してみた�
20(C) Recruit Communications Co.,Ltd. All rights reserved. �
• グループ数を減らす→候補に残る類似度の閾値が大きくなる�
• グループ数 b =1の場合、完全一致(類似度 1.0)の�
ものしか選ばれないということなので、納得�
• ある程度グループに分けることで、「まぁまぁ近いもの」�
を集めることが出来る�→�クラスタリング�