Skip to content
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 np.issubdtype warning #2210

Merged
merged 2 commits into from Oct 5, 2018

Conversation

Projects
None yet
2 participants
@marioyc
Copy link
Contributor

commented Oct 3, 2018

Modify check of subtypes of np.int for subtypes of np.signedinteger or np.unsignedinteger

Fixes #2188

@menshikh-iv

This comment has been minimized.

Copy link
Collaborator

commented Oct 4, 2018

Hi @marioyc, thanks for PR, can you please

  1. Fix this issue everywhere (not only in matutils.py):
ivan@P50:~/release/gensim$ find gensim -name "*.py" | xargs grep "np.issubdtype"
gensim/test/test_ldamodel.py:                self.assertTrue(np.issubdtype(v, float))
gensim/test/test_ldamodel.py:            self.assertTrue(np.issubdtype(v, float))
gensim/test/test_ldamodel.py:                self.assertTrue(np.issubdtype(v, float))
gensim/test/test_ldamodel.py:                self.assertTrue(np.issubdtype(v, float))
gensim/test/test_ldamodel.py:                self.assertTrue(np.issubdtype(v, float))
gensim/test/test_ldamodel.py:            self.assertTrue(np.issubdtype(v, float))
gensim/test/test_ldamodel.py:            self.assertTrue(np.issubdtype(probability, float))
gensim/test/test_ldamodel.py:            self.assertTrue(np.issubdtype(probability, float))
gensim/test/test_matutils.py:        self.assertTrue(np.issubdtype(unit_vector.dtype, float))
gensim/test/test_matutils.py:        self.assertTrue(np.issubdtype(unit_vector.dtype, float))
gensim/test/test_matutils.py:        self.assertTrue(np.issubdtype(unit_vector.dtype, float))
gensim/test/test_matutils.py:        self.assertTrue(np.issubdtype(unit_vector.dtype, float))
gensim/test/test_matutils.py:        self.assertTrue(np.issubdtype(unit_vector.dtype, float))
gensim/test/test_matutils.py:        self.assertTrue(np.issubdtype(unit_vector.dtype, float))
gensim/matutils.py:            if np.issubdtype(vec.dtype, np.int):
gensim/matutils.py:            if np.issubdtype(vec.dtype, np.int):
  1. Put here any link for confrimation than proposed way are correct (maybe some info from numpy doc or something similar)
@marioyc

This comment has been minimized.

Copy link
Contributor Author

commented Oct 5, 2018

Hi @menshikh-iv ,

from the numpy docs (https://docs.scipy.org/doc/numpy/reference/arrays.scalars.html) it looks like the correct types on hierarchy are np.integer and np.floating

@menshikh-iv

This comment has been minimized.

Copy link
Collaborator

commented Oct 5, 2018

Thank you @marioyc, congratz with the first contribution, happy hacktoberfest 🌟

@menshikh-iv menshikh-iv merged commit 61a42da into RaRe-Technologies:develop Oct 5, 2018

3 checks passed

ci/circleci Your tests passed on CircleCI!
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

rsdel2007 added a commit to rsdel2007/gensim that referenced this pull request Jan 11, 2019

Fix `np.issubdtype` warnings (RaRe-Technologies#2210)
* modify check of subsinstances of np.int for subinstances of np.signedinteger and np.unsignedinteger

* change to np.integer and np.floating
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.