jaccard_distance, a Python code which computes the Jaccard distance between two sets.

The Jaccard index of two sets A and B is denoted J(A,B), and is evaluated as |A intersect B| / |A union B|.

The Jaccard distance is 1-J(A,B), which has the usual properties of a distance function.


The computer code and data files described and made available on this web page are distributed under the MIT license


jaccard_distance is available in a MATLAB version and an Octave version and a Python version.

Related Data and Programs:

python_distance, a Python code which estimates the typical distance between a pair of points randomly selected from the surface or interior of a geometric object such as a circle, disk, sphere, cube, and between other nongeometric pairs of items.


  1. John D Cook,
    Jaccard index and jazz albums,
    Posted 26 July 2023.

Source Code:

Last revised on 14 November 2023.