The Jaccard coefficient measures similarity between finite sample sets, and is defined as the size of the intersection divided by the size of the union of the sample sets.

I had 100 sets all of same cardinality. By mistake I calculated the similarity measures as the ratio of intersection with total elements in a set (i.e 100).

This gives different similarity values than the original Jaccard formula.

I was wondering if the original formula has considered the union of two sets to handle cases where there might be sets with different cardinalities.

I think though numerically my values are different, they repersent the same idea.

If anybody could verify/disverify what I am trying to do ?


1 Answer 1


Yes, the Jaccard similarity score is normalized by the union to deal with sets of different cardinality. Without this normalization (if you used just the intersection), very small sets would always have very low scores.

When the cardinalities of all your sets are the same, the union of any two sets will be a straightforward function of the intersection (this is easy to visualize - as the two sets intersect more and more, their unions get smaller and smaller). The formula is:

union = 2 * cardinality - intersection

So the Jaccard score in your case would be:

intersection / (200 - intersection)

If you plot this, you'll see it's monotonically the same as what you did.


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.