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: remove numpy deprecations #7

Merged
merged 3 commits into from
May 9, 2023
Merged

Conversation

dsgibbons
Copy link
Owner

Fixes deprecation warnings as per shap#1890

fix: remove numpy deprecations in root shap

fix: remove numpy deprecations in nested dir
Copy link
Collaborator

@thatlittleboy thatlittleboy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM in general.

But there seems to be a couple more (in the notebooks) that the original PR missed. Shall we fix these too?

image

Secondly, I noticed that np.bool8 is also getting deprecated in numpy 1.24, I thought we might take this chance to also fix it here if it's not too troublesome.

image

@thatlittleboy
Copy link
Collaborator

thatlittleboy commented May 8, 2023

There's np.object also that was missed out (found this while running tests)

>>> import numpy as np; np.__version__
'1.24.3'
>>> np.object
<stdin>:1: FutureWarning: In the future `np.object` will be defined as the corresponding NumPy scalar.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/xxx/forks/shap/venv/lib/python3.8/site-packages/numpy/__init__.py", line 305, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'object'.
`np.object` was a deprecated alias for the builtin `object`. To avoid this error in existing code, use `object` by itself. Doing this will not modify any behavior and is safe.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

image

@dsgibbons
Copy link
Owner Author

Good spot! I think that's all of them

Copy link
Collaborator

@thatlittleboy thatlittleboy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

smiling-cat-face-lgtm

@dsgibbons dsgibbons merged commit 715f722 into master May 9, 2023
@thatlittleboy thatlittleboy deleted the remove-np-deprecations branch May 10, 2023 00:12
@thatlittleboy
Copy link
Collaborator

thatlittleboy commented May 12, 2023

Just wanted to mention / link a couple more related issues about the same topic:

  • slundberg#2769
  • slundberg#2837
  • slundberg#2878
  • slundberg#2911

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