The Jaccard index–otherwise known as intersection over union–is used to calculate the similarity or difference of sample sets.
\[ J(\mathbb{A}, \mathbb{B}) = \frac{\left | \mathbb{A} \cap \mathbb{B} \right |} {\left | \mathbb{A} \cup \mathbb{B} \right |} \]
\[ 0 \leq J(\mathbb{A}, \mathbb{B}) \leq 1 \]
The index is defined to be 1 if the sets are empty.