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

Compatibility with >= Numpy 2.0.0 (update of ptp method) #571

Closed
Chip2916 opened this issue Sep 27, 2024 · 3 comments
Closed

Compatibility with >= Numpy 2.0.0 (update of ptp method) #571

Chip2916 opened this issue Sep 27, 2024 · 3 comments
Labels
bug 💣 Bug to fix maintenance 🔨 Code enhancements, tests and maintenance Python 🐍 Related to Python short term ⏰ TODO short term

Comments

@Chip2916
Copy link
Contributor

Chip2916 commented Sep 27, 2024

Hey Dalex team!

Working on a package that has Dalex and Numpy as dependencies and have encountered an issue when using Dalex with >= Numpy 2.0.0.

When calling VariableImportance.plot() an error is raised (see below) due to the use of dl.ptp() here.

This is also present in other scripts such as AggregatedProfiles.plot() here

use of array.ptp() throughout the package would need to be replaced by np.ptp(array) to be compatible with latest numpy versions. This fix should not cause any issues for those who are still using numpy < 2.0.0.

Error:

image

Numpy Doc

As per the numpy migration guide certain methods have been replaced. One of them being array.ptp() being replaced by np.ptp(array)

image

@hbaniecki
Copy link
Member

Hi @Chip2916 , big thanks for raising this issue. I shall fix this ASAP (or feel free to contribute a PR with changes like x.ptp() -> np.ptp(x))

@hbaniecki hbaniecki added bug 💣 Bug to fix Python 🐍 Related to Python short term ⏰ TODO short term maintenance 🔨 Code enhancements, tests and maintenance labels Sep 27, 2024
@Chip2916
Copy link
Contributor Author

Chip2916 commented Oct 1, 2024

No problem, PR raised - also replaced instances of np.Inf with np.inf as latest Numpy releases removed use of np.Inf as part of change to namespaces to avoid multiple ways to access same attribute

hbaniecki pushed a commit that referenced this issue Oct 2, 2024
…572)

* Replaced use of x.ptp() with np.ptp(x)

* Replaced np.Inf with np.inf

* Updated change log
@hbaniecki
Copy link
Member

hbaniecki commented Oct 2, 2024

Thank you! A new dalex v1.7.1 with the fix is now on PyPI https://pypi.org/project/dalex/1.7.1/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 💣 Bug to fix maintenance 🔨 Code enhancements, tests and maintenance Python 🐍 Related to Python short term ⏰ TODO short term
Projects
None yet
Development

No branches or pull requests

2 participants