Skip to content

Instantly share code, notes, and snippets.

@aravindpai
Created March 12, 2020 10:26
Show Gist options
  • Save aravindpai/dd4cd6593f9cbde3bc41d8a24b5d4e7a to your computer and use it in GitHub Desktop.
Save aravindpai/dd4cd6593f9cbde3bc41d8a24b5d4e7a to your computer and use it in GitHub Desktop.
# create a weight matrix for words in training docs
embedding_matrix = np.zeros((size_of_vocabulary, 300))
for word, i in tokenizer.word_index.items():
embedding_vector = embeddings_index.get(word)
if embedding_vector is not None:
embedding_matrix[i] = embedding_vector
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment