Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

cosine similarity python

from numpy import dot
from numpy.linalg import norm

def cosine_similarity(list_1, list_2):
  cos_sim = dot(list_1, list_2) / (norm(list_1) * norm(list_2))
  return cos_sim
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #cosine #similarity #python
ADD COMMENT
Topic
Name
3+3 =