Created
December 21, 2020 16:44
-
-
Save HeenaR17/199a3c39a2a01644fa14a834f0df815e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def cosine_similarity(x1, x2): | |
return np.round(np.dot(x1, x2)/(np.linalg.norm(x1)*np.linalg.norm(x2)),5) | |
print(cosine_similarity(word2vec.get_vector("winter"), word2vec.get_vector("summer"))) | |
word2vec.similarity("winter","summer") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment