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

AttributeError: module 'numpy' has no attribute 'int'. np.int was a deprecated alias for the builtin int. #122

Open
jorgesolerrr opened this issue Oct 25, 2023 · 13 comments

Comments

@jorgesolerrr
Copy link

This happens when the fit method is used

@jorgesolerrr
Copy link
Author

This may be because I use an advanced version of numpy

@ACakshay
Copy link

ACakshay commented Oct 26, 2023

np.int got decrypted in Numpy 1.20, it should be changed to np.int_ or np.int32/64

@rajesvariparasa
Copy link

The following datatypes need to be changed,

  • np.int to np.int32,
  • np.float to np.float64 and
  • np.bool to np.bool_

@VEZcoding
Copy link

This package needs to be updated. Since its very far behind versions of other packages. And a lot of other functionalities that are not part of conda or pypi package.

@danielhomola
Copy link
Collaborator

Can someone please make a PR with all updates and I'll approve it. Sorry for being so slow.

@raychan0410
Copy link

I am still encountering the same problem
Can someone advise how to get around the issue?
use some dev version of boruta_py? or downgrade numpy?
thanks in advance

@VEZcoding
Copy link

VEZcoding commented Dec 1, 2023 via email

@paulgillespie
Copy link

I was able to downgrade numpy to 1.23.5 and it appears to be working. Not the most elegant solution but "solution" is the key word. :)

@VEZcoding
Copy link

VEZcoding commented Dec 2, 2023 via email

@cecilialee
Copy link

cecilialee commented Dec 6, 2023

I prefer not to downgrade numpy. A workaround is to simply manually assign np.int, np.float, np.bool before calling fit().

np.int = np.int32
np.float = np.float64
np.bool = np.bool_

boruta = BorutaPy(estimator=rf)
boruta.fit(x, y)

Works for me under the below package versions:

python=3.11.6
numpy=1.26.2
boruta_py=0.3

@at672
Copy link

at672 commented Jan 16, 2024

I want to chime in here. First off, cecilialee's solution worked nicely, so thank you for that.

Browsing the source code on the repo: https://github.com/scikit-learn-contrib/boruta_py/blob/master/boruta/boruta_py.py

I see that this issue has been fixed. If you do a simple ctrl+f, you'll see zero instances of np.int. It seems to have been fixed in the .py file. However, when installing the package into my conda virtual environment (version 0.3 of this package), the error persists because the source code the package is running seems to be an older version.

I'm not an expert on creating python packages, but it seems to be an issue with using the updated source code in the package itself.

@vedanshchn
Copy link

I prefer not to downgrade numpy. A workaround is to simply manually assign np.int, np.float, np.bool before calling fit().

np.int = np.int32
np.float = np.float64
np.bool = np.bool_

boruta = BorutaPy(estimator=rf)
boruta.fit(x, y)

Works for me under the below package versions:

python=3.11.6
numpy=1.26.2
boruta_py=0.3

This worked for me as well! Thanks!

@kitsbits
Copy link

I want to chime in here. First off, cecilialee's solution worked nicely, so thank you for that.

Browsing the source code on the repo: https://github.com/scikit-learn-contrib/boruta_py/blob/master/boruta/boruta_py.py

I see that this issue has been fixed. If you do a simple ctrl+f, you'll see zero instances of np.int. It seems to have been fixed in the .py file. However, when installing the package into my conda virtual environment (version 0.3 of this package), the error persists because the source code the package is running seems to be an older version.

I'm not an expert on creating python packages, but it seems to be an issue with using the updated source code in the package itself.

I've found the same thing. I wonder if this is an issue with one of the modules imported from sklearn and the mismatch is bubbling up:

from sklearn.utils import check_random_state, check_X_y
from sklearn.base import TransformerMixin, BaseEstimator

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

No branches or pull requests