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% 

I really get confused, please help.

  • $\begingroup$ 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. $\endgroup$
    – ttnphns
    Sep 30, 2015 at 16:53
  • $\begingroup$ Thanks for your comment.. do you think the first approach is better? $\endgroup$
    – mOna
    Sep 30, 2015 at 16:57
  • $\begingroup$ 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. $\endgroup$
    – ttnphns
    Sep 30, 2015 at 17:01
  • $\begingroup$ I don't know what is "better". Better in what situation? $\endgroup$
    – ttnphns
    Sep 30, 2015 at 17:02
  • $\begingroup$ @ttnphns: actually, these two list are explicit & implicit user profiles. A: explicit opinion of users on cast (their favite cast) and B: Implicit casts based on movies she liked... my goal is to see how much users select a movie based on their explicit preferences on Features of movie (such as cast/director/genre).. $\endgroup$
    – mOna
    Sep 30, 2015 at 22:18


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.