Created
August 8, 2019 00:54
-
-
Save paulegradie/8fae6947050c8bc89750d565d0f5732b 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
# assigns the row from the embedding matrix to the named variable | |
king = embed_matrix[word_to_index['king']] | |
male = embed_matrix[word_to_index[‘male’]] | |
female = embed_matrix[word_to_index[‘female']] | |
queen = embed_matrix[word_to_index['queen']] | |
# the formula now uses the vectors from the embedding matrix | |
assert (king - man) + woman ≈ queen |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment