-
-
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
Fix scipy logsumexp deprecation warning #1703
Fix scipy logsumexp deprecation warning #1703
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix problem with imports
gensim/models/ldamodel.py
Outdated
@@ -48,7 +48,7 @@ | |||
from gensim.models.callbacks import Callback | |||
|
|||
# log(sum(exp(x))) that tries to avoid overflow | |||
from scipy.misc import logsumexp | |||
from scipy.special import logsumexp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For 1.0.0
it works, but as you see in https://github.com/RaRe-Technologies/gensim/blob/develop/setup.py#L290 our minimal version is 0.18.1
, in this version, this import will be failed.
Import must work for any scipy >=0.18.1
Thanks for the comment! I fixed the problem with imports. |
Thank you @dreamgonfly, congratz with first contribution 🥇 |
This fix probably not available on the latest pip or conda installation? or is it? |
@uduwage fix will be available in next release (~first week of December). Alternative way - you can install |
* Fix scipy logsumexp deprecation warning * Fix import error
Problem
I noticed that when training LDA model with the latest version of scipy I get a deprecation warning.
Reason
I dug into the problem and found that scipy 1.0.0 has been released recently.
https://scipy.github.io/devdocs/release.1.0.0.html
In the release they deprecated a number of functions from
scipy.misc
, andlogsumexp
is one of them. The link below is the corresponding commit.scipy/scipy#7246
Solution
I fixed the warning by making
logsumexp
to be imported fromscipy.special
, as they recommend.Also I checked that, except in LdaModel,
logsumexp
is not used in any other places in gensim .