Skip to content

Instantly share code, notes, and snippets.

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) + womanqueen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment