-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Word2Vec ns_exponent cannot be changed from default #2746
Comments
Thanks for the clear report! The problem can be even more compactly demonstrated: In [1]: from gensim.models import Word2Vec
In [2]: model = Word2Vec(ns_exponent=0.1)
In [3]: model.ns_exponent
Out[3]: 0.75 While this is a confusing bit of model state, I'm pretty sure your intended value still took effect – it's just that it was passed into a separate In [4]: model.vocabulary.ns_exponent
Out[4]: 0.1 The code problem is that There's a refactor-in-progress (#2698) that will resolve this, making the |
Thank you for the thorough and prompt response! This sets my heart at ease. I'll edit the issue as you suggested and use your fix. |
Fixed by #2698. |
Problem description
I am trying to train Word2Vec and tune the
ns_exponent
hyperparameter. When I initialize the model, I setns_exponent = 0.5
, but find that it has reset to the default ofns_exponent = 0.75
immediately after initializing.I looked through the Word2Vec source code for any mentions of
ns_exponent
, but found no reason for the class to ignore my argument. I suspected the Vocabulary initialization may have something to do with it, but that seems to take its argument straight from the__init__
. Neither do I believe that I am overriding thens_exponent
setting with one of the other parameters, because this occurs even whenns_exponent
is the only one explicitly set.Steps/code/corpus to reproduce
The printed output is:
and the resulting model's
ns_exponent
attribute is set to 0.75 as well.Versions
The text was updated successfully, but these errors were encountered: