# should I count repeated items in jaccard similarity?

I have two lists: A and B where Size(A) = 4 and size(B) = 10. I would like to find the Jaccard similarity between these two lists.

Suppose A = {Tom, George, John, Jennifer} and B={Tom, Jessica, Angel, Hanna, Tom, John, Michele, Edward, Alex, Tom}

As far as I know, Jaccard is measured by = (Intersect A, B)/(Union A,B) and I read here, that jaccard similarity is the number of common attributes divided by the number of attributes that exists in at least one of the two objects that is: p/p+q+r where "p" is number of common attributes, "q" is # of attributes 1 for A and 0 for B while "r" is # of attributes 0 for A and 1 for B.

My question Considering the above formula (if it is correct), should I count the repeated items in list B (that is "Tom" in this example)? so, is the following correct:

Jaccard(A,B) = 2/2+2+6 = 20%


or should I ignore repeated item "Tom", and write like this:

Jaccard(A,B) = 2/2+2+8 = 16.6%


• It is your choice. Originally Jaccard similarity was formulated for binary data, where an attribute is either present or absent, and not counted. Tom therefore cannot appear in a set more than once. If it appears - discard the duplicates. However, you might prefer your second approach as well: what you did is like introducing three "Tom" attributes: Tom1, Tom2, Tom3; set1 ans set2 agree once, i.e. on Tom1, the other two "Toms" are found in set2 but were never "initialized" in set1. – ttnphns Sep 30 '15 at 16:53
• You might prefer other coefficients instead of Jaccard, for example Kulczynski-2. It uses two different bases (denominators), and in your case it will be (2/4 + 2/k)/2, where k=8 if you prefer to count Tom once or k=10 if you prefer to count it thrice. – ttnphns Sep 30 '15 at 17:01