I understand how to calculate the jaccard similarity , but never quite understood the logic behind why are we calculating it. How does it show the similarity between two sets? What relation exactly does it show? Can someone throw some light on this?


The Jaccard index is $J(A, B) = \frac{|A \cap B|}{|A\cup B|}$. The numerator $|A \cap B|$ counts the number of times an item occurs in both $A$ and $B$. The denominator $|A\cup B|$ counts the number of distinct items in total in $A$ and $B$.

Hence $J(A, B)$ is the fraction of items that are shared between the two sets.

  • $\begingroup$ Please give any usecase where we can implement in term of machine learning. $\endgroup$ – yogesh agrawal Feb 1 at 12:53
  • 1
    $\begingroup$ @yogeshagrawal I have used it in feature selection studies. When building a model that includes a feature selection step, how stable can you expect the selected feature set to be? By perturbing the data set (bootstrapping) and repeating the feature selection, I calculate $J(set_k, set_{k+1})$ to get an idea of how many/which of my originally selected features are likely to be selected in new data. $\endgroup$ – einar Feb 1 at 13:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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