Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

scipy cosine similarity

from scipy.spatial import distance

distance.cosine([1, 0, 0], [0, 1, 0])
>>> 1.0

distance.cosine([100, 0, 0], [0, 1, 0])
>>> 1.0

distance.cosine([1, 1, 0], [0, 1, 0])
>>> 0.29289321881345254
 
PREVIOUS NEXT
Tagged: #scipy #cosine #similarity
ADD COMMENT
Topic
Name
4+6 =