提供推荐 Making Recommendation

Jaccard / Tanimoto Coefficient

In some case, each attribute is binary such that each bit represents the absence of presence of a characteristic, thus, it is better to determine the similarity via the overlap, or intersection, of the sets.

Simply put, the Tanimoto Coefficient uses the ratio of the intersecting set to the union set as the measure of similarity. Represented as a mathematical equation:

Tanimoto Coefficient主要用于计算符号度量或布尔值度量的个体间的相似度，因为个体的特征属性都是由符号度量或者布尔值标识，因此无法衡量差异具体值的大小，只能获得“是否相同”这个结果，所以Tanimoto Coefficient只关心个体间共同具有的特征是否一致这个问题。Tanimoto Coefficient又被叫做Jaccard Coefficient，其值等于两个用户共同关联（不管喜欢还是不喜欢）的物品数量除于两个用户分别关联的所有物品数量。 $Jaccard(X, Y) = \frac{X \cap Y}{X \cup Y}$

$T(a,b) = \frac{N_c}{N_a + N_b - N_c}$

In this equation, N represents the number of attributes in each object (a,b). C in this case is the intersection set.

余弦相似度 Cosine Similarity

This metric is frequently used when trying to determine similarity between two documents.

In this similarity metric, the attributes (or words, in the case of the documents) is used as a vector to find the normalized dot product of the two documents. By determining the cosine similarity, the user is effectively trying to find cosine of the angle between the two objects. For cosine similarities resulting in a value of 0, the documents do not share any attributes (or words) because the angle between the objects is 90 degrees. Expressed as a mathematical equation:

$similarity(x,y) = \cos(\theta) = \frac{x \cdot y}{\left \| x \right \| * \left \| y \right \| } = \frac{\sum\limits_{i=1}^n A_i B_i}{\sqrt{\sum\limits_{i=1}^n A_i^2} \sqrt{\sum\limits_{i=1}^n B_i^2}}$