Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
def jaccard(list_a, list_b):
"""
Calculates the jaccard index from two python lists.
:param list_a: First list
:param list_b: Other list
:return: The jaccard index
"""
union_count = len(set(list_a + list_b))
intersection_count = len(set(list_a).intersection(set(list_b)))
return intersection_count/union_count