LingPy

This documentation is for version 2.0.dev, which is not released yet.

lingpy.algorithm.distance.jaccard

lingpy.algorithm.distance.jaccard(set1, set2)

Computer the Jaccard distance between two sets.

Jaccard distance measures the dissimilarity between sample sets. It is complementary to the Jaccard coefficient and is obtained by subtracting the Jaccard coefficient from 1, or, equivalently, by dividing the difference of the sizes of the union and the intersection of two sets by the size of the union:

J(A,B) = 1 - J(A,B) = |A ∪ B| - |A ∩ B| / |A ∪ B|

Parameters :

set1 : set

set to be compared to set2

set2 : set

set to be compared to set1

Returns :

_ : float

the Jaccard distance

This Page