-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
word2vec overflow when running #838
Comments
Have you tried using the compiled C extension? It is much faster than pure Python. Could you please give more instructions on how to reproduce? A sample corpus would help. |
I'm sorry, it's long time to check the mail. I can't use the C version, Because it depends the C complier lib\ best regards thanks 2016-08-29 16:31 GMT+08:00 Lev Konstantinovskiy notifications@github.com:
|
The necessary C compilation tools should be freely available on all platforms where gensim runs – and they can offer a 100X or more speedup. For example, they can turn runtimes that would be over 4 days (without) into under-an-hour. So, we highly recommend ensuring the optimized code is running. Still, there shouldn't be any fatal warnings in the pure-python code. Does the warning actually cause execution to stop, or does your training still complete and result in usable word-vectors? (I think the |
If the values aren't too big then this solution will help: def inv_logit(p):
if p > 0:
return 1. / (1. + np.exp(-p))
elif p <= 0:
np.exp(p) / (1 + np.exp(p))
else:
raise ValueError |
That should do the trick as well. Sending a PR, merge if it helps. |
Fixed RuntimeWarning: overflow encountered in exp.
Fixed RuntimeWarning: overflow encountered in exp
Fixed RuntimeWarning: overflow encountered in exp
Is there an example of a |
Fixed in #895 |
/gensim-0.13.1/gensim/models/word2vec.py:296: RuntimeWarning: overflow encountered in exp
fb = 1. / (1. + exp(-dot(l1, l2b.T))) # propagate hidden -> output
how can fix it, thank you
The text was updated successfully, but these errors were encountered: