scikit-learn-contrib / boruta_py

Python implementations of the Boruta all-relevant feature selection method.
BSD 3-Clause "New" or "Revised" License
1.46k stars 252 forks source link

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

Open jorgesolerrr opened 8 months ago

jorgesolerrr commented 8 months ago

This happens when the fit method is used

jorgesolerrr commented 8 months ago

This may be because I use an advanced version of numpy

ACakshay commented 8 months ago

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

rajesvariparasa commented 8 months ago

The following datatypes need to be changed,

VEZcoding commented 7 months ago

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 commented 7 months ago

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

raychan0410 commented 7 months ago

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 commented 7 months ago

For the time being just downgrade numpy.

On Fri, 1 Dec 2023, 11:28 raychan0410, @.***> wrote:

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

— Reply to this email directly, view it on GitHub https://github.com/scikit-learn-contrib/boruta_py/issues/122#issuecomment-1835845825, or unsubscribe https://github.com/notifications/unsubscribe-auth/AR6CWL2VN76WPYTZR2ROIELYHGWLPAVCNFSM6AAAAAA6PNEGKSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMZVHA2DKOBSGU . You are receiving this because you commented.Message ID: @.***>

paulgillespie commented 7 months ago

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 commented 7 months ago

Yes, someone needs to update this pacakge. Conda/pip still have 0.3 versions.

On Sat, 2 Dec 2023, 02:20 paulgillespie, @.***> wrote:

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. :)

— Reply to this email directly, view it on GitHub https://github.com/scikit-learn-contrib/boruta_py/issues/122#issuecomment-1836978452, or unsubscribe https://github.com/notifications/unsubscribe-auth/AR6CWLYRQNWJ2TMKSPRJQR3YHJ66NAVCNFSM6AAAAAA6PNEGKSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMZWHE3TQNBVGI . You are receiving this because you commented.Message ID: @.***>

cecilialee commented 6 months ago

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 commented 5 months ago

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 commented 5 months ago

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 commented 5 months ago

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