I am using gensim word2vec package in python.
I would like to retrieve the W
and W'
weight matrices that have been learn during the skip-gram learning.
It seems to me that model.syn0
gives me the first one but I am not sure how I can get the other one. Any idea?
I would actually love to find any exhaustive documentation on models accessible attributes because the official one does not seem to be precise (for instance syn0
is not described as an attribute)
The model.wv.syn0
contains the input embedding matrix. Output embedding is stored in model.syn1
when it's trained with hierarchical softmax (hs=1
) or in model.syn1neg
when it uses negative sampling (negative>0
). That's it! When both hierarchical softmax and negative sampling are not enabled, Word2Vec
uses a single weight matrix model.wv.syn0
for training.
See also a related discussion here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With