Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (50.2k points)
I am having two lists with usernames and I want to compute the Jaccard similarity. I want to know whether it is possible?

1 Answer

0 votes
by (107k points)

Do check the below code for the reference regarding Jaccard  similarity:

def jaccard_similarity(list1, list2):

    intersection = len(list(set(list1).intersection(list2)))

    union = (len(list1) + len(list2)) - intersection

    return float(intersection) / union

For more information regarding the same, do refer to the Python online course that will help you regarding the same in a better way. 

Related questions

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...