Fix scipy logsumexp deprecation warning#1703
Merged
menshikh-iv merged 2 commits intoNov 9, 2017
Merged
Conversation
menshikh-iv
suggested changes
Nov 9, 2017
Contributor
menshikh-iv
left a comment
There was a problem hiding this comment.
Please fix problem with imports
|
|
||
| # log(sum(exp(x))) that tries to avoid overflow | ||
| from scipy.misc import logsumexp | ||
| from scipy.special import logsumexp |
Contributor
There was a problem hiding this comment.
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
Contributor
Author
|
Thanks for the comment! I fixed the problem with imports. |
Contributor
|
Thank you @dreamgonfly, congratz with first contribution 🥇 |
|
This fix probably not available on the latest pip or conda installation? or is it? |
Contributor
|
@uduwage fix will be available in next release (~first week of December). Alternative way - you can install |
VaiyeBe
pushed a commit
to VaiyeBe/gensim
that referenced
this pull request
Nov 26, 2017
* Fix scipy logsumexp deprecation warning * Fix import error
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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, andlogsumexpis one of them. The link below is the corresponding commit.scipy/scipy#7246
Solution
I fixed the warning by making
logsumexpto be imported fromscipy.special, as they recommend.Also I checked that, except in LdaModel,
logsumexpis not used in any other places in gensim .