About embedding_weights
See original GitHub issueFirst, thank you for code sharing.
In w2v.py, I saw your code as follows:
embedding_weights = [np.array([embedding_model[w] if w in embedding_model
else np.random.uniform(-0.25, 0.25, embedding_model.vector_size)
for w in vocabulary_inv])]
For obtaining weights from embedding_model, parameter w must be a word, e.g. “happy”. But, in w2v.py, "for w in embedding_model ", w is an index of word
Is that a mistake here? The code “else np.random.uniform(-0.25, 0.25, embedding_model.vector_size)” seems been executed in every loop.
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Embedding — PyTorch 1.13 documentation
Creates Embedding instance from given 2-dimensional FloatTensor. Parameters: embeddings (Tensor) – FloatTensor containing weights for the Embedding. First ...
Read more >Understanding Embedding Layer in Keras - Medium
Once the training is completed, embedding layer has learnt the weights which are nothing but the vector representations of each word. Lets check ......
Read more >Neural Network Embeddings Explained - Towards Data Science
The embeddings form the parameters — weights — of the network which are adjusted to minimize loss on the task.
Read more >Embedding layer - Keras
Embedding class. Turns positive integers (indexes) into dense vectors of fixed size. This layer can only be used on positive integer inputs of...
Read more >What does a weighted word embedding mean? - Stack Overflow
1). The second represents a sentence by averaging the word embeddings of all words (in the sentence) and the third represents a sentence...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Looks okay. embedding_weights must be a list of len=1 of ndarray with shape=(len(vocabulary_inv), num_features). It was made a list for compatibility with keras layer.set_weights()
Please see updated version