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
Merged

Conversation

marioyc
Copy link
Contributor

@marioyc marioyc commented Oct 3, 2018

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

Fixes #2188

@menshikh-iv
Copy link
Contributor

menshikh-iv 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
Copy link
Contributor Author

marioyc 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
Copy link
Contributor

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

@menshikh-iv menshikh-iv merged commit 61a42da into piskvorky:develop Oct 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants