Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# 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
You can’t perform that action at this time.