Skip to content

Instantly share code, notes, and snippets.

@Spartee
Created August 11, 2022 19:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Spartee/1f5f283d09a8a6d102ca79429b0e31b4 to your computer and use it in GitHub Desktop.
Save Spartee/1f5f283d09a8a6d102ca79429b0e31b4 to your computer and use it in GitHub Desktop.
Cosine similarity formula in Python
def cosine_similarity(a, b):
return np.dot(a, b)/(norm(a)*norm(b))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment