-
-
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
Make most_similar accept topn of any integer type #2497
Conversation
7060ee8
to
eefeb83
Compare
I tried to force-push a couple of times, but AppVeynor consistently fails to install dependencies. |
CC @mpenkov – can you please assist Vitek with the CI (AppVeyor) problems? |
Looks like appveyor is failing to install numpy under Py2:
@menshikh-iv Any idea why that could be? On a related note, numpy will be dropping Py2 support in less than a year (https://www.numpy.org/neps/nep-0014-dropping-python2.7-proposal.html)... @piskvorky What does that mean for gensim and our plans for Py2 support in the future? |
Thanks to upd: as an alternative way (if you looking to link above) - install numpy first (in separate command BEFORE |
@mpenkov I don't think it means anything for us. We're not using any functionality from the newer NumPy releases. That In other words, we can continue to require a fairly old version of NumPy (the latest that supports py2?). But users are free to install newer versions of NumPy too — we don't care. |
Please note that if we drop the |
I removed deps =
py37: numpy==1.14.5
py37: scipy==1.1.0
py27: numpy==1.11.3
py27: scipy==0.18.1
py35: numpy==1.11.3
py35: scipy==0.18.1
py36: numpy==1.11.3
py36: scipy==0.18.1
linux: .[test]
win: .[test-win] extras_require={
'distributed': distributed_env,
'test-win': win_testenv, win_testenv = [
'pytest',
'pytest-rerunfailures',
'mock',
'cython',
'testfixtures',
'scikit-learn',
'Morfessor==2.0.2a4',
'python-Levenshtein >= 0.10.2',
'visdom >= 0.1.8, != 0.1.8.7',
] |
So, now the issue with scikit-learn, because they don't support python2 more
|
I reverted the |
@menshikh-iv I'm +1 for removing Py2 support. We could do this in the next major release. If people are keen to continue using Py2, then that's fine, they can keep using gensim 3.x. @piskvorky WDYT? |
Yes, next major release (4.x) is OK. No clear release date nor milestones for 4.x though, so this is theoretical for now. Getting Gensim into a better shape is more important ( Sorry for hijacking your PR @Witiko :) |
I don't mind, dropping the Python 2 support is an interesting topic. Please, let me know if I can help, or when I can rerun the tests for this PR. |
@piskvorky @Witiko I fixed the AppVeyor problems. Is this ready to merge? |
@mpenkov Great work! Yes, this PR should be ready to merge. |
@mpenkov ping. After fixing |
OK, merged. @Witiko Thank you for your contribution and your patience. @piskvorky What do you think about the scope of this change? This seems to be new functionality: does it warrant a minor version bump? |
Looking at the PR description: this looks like a textbook bug fix. Which part do you see as substantial? |
I think I got it mixed up with another PR. We'll treat this as a bugfix. |
This PR continues #2356 and #2461 and closes #2496. The PR makes the following changes:
most_similar
(PoincareKeyedVectors
) that I missed in Fix WordEmbeddingsKeyedVectors.most_similar #2461.numbers.Integral
to be accepted as the parametertopn
inmost_similar
. This change also adds a unit test.most_similar
not to usetopn=0
. This is because there are many implementations ofmost_similar
and expecting all the current and future implementations to uphold the contract seems naive.SparseTermSimilarityMatrix
consistent and prevents a possible integer overflow.