Last active
December 9, 2019 18:02
-
-
Save horiacristescu/ebf6ab41ed4054639d7d02c857d97b36 to your computer and use it in GitHub Desktop.
Ranking by dot product
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 inner_product_rank(self, vecs, threshold=0.5): | |
sims_mat = np.dot(vecs, vecs.transpose()) | |
sims_mat = sims_mat - threshold | |
sims_mat[sims_mat<0] = 0 | |
ranks = np.sum(sims_mat, axis=0) | |
return ranks | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment