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

np.NINF was removed in the NumPy 2.0 release. Use -np.inf instead #1100

Open
tam-nguyenminh opened this issue Jun 25, 2024 · 2 comments
Open

Comments

@tam-nguyenminh
Copy link

Hello,

I got this error while trying to use SequentialFeatureSelector.
Could you please help take a look in the underlying codes?
Thanks a lot

sfs = SFS(LogisticRegression(), k_features=5, #number of features to select forward = True, #rolling forward selection floating=False, # No floating selection scoring='accuracy', verbose=5, cv=5 ).fit(X_train,y_train)


AttributeError Traceback (most recent call last)
Cell In[214], line 8
1 sfs = SFS(LogisticRegression(),
2 k_features=5, #number of features to select
3 forward = True, #rolling forward selection
4 # floating=False, # No floating selection
5 scoring='accuracy',
6 verbose=5,
7 cv=5
----> 8 ).fit(X_train,y_train)

File c:\Users\84393\miniconda3\envs\venv_ds\Lib\site-packages\mlxtend\feature_selection\sequential_feature_selector.py:650, in SequentialFeatureSelector.fit(self, X, y, groups, **fit_params)
648 else:
649 self.fitted = True # the completion of sequential selection process.
--> 650 self.finalize_fit()
652 return self

File c:\Users\84393\miniconda3\envs\venv_ds\Lib\site-packages\mlxtend\feature_selection\sequential_feature_selector.py:655, in SequentialFeatureSelector.finalize_fit(self)
654 def finalize_fit(self):
--> 655 max_score = np.NINF
656 for k in self.subsets_:
657 if (
658 k >= self.min_k
659 and k <= self.max_k
660 and self.subsets_[k]["avg_score"] > max_score
661 ):

File c:\Users\84393\miniconda3\envs\venv_ds\Lib\site-packages\numpy_init_.py:411, in getattr(attr)
408 raise AttributeError(former_attrs[attr])
410 if attr in expired_attributes:
--> 411 raise AttributeError(
412 f"np.{attr} was removed in the NumPy 2.0 release. "
413 f"{expired_attributes[attr]}"
414 )
416 if attr == "chararray":
417 warnings.warn(
418 "np.chararray is deprecated and will be removed from "
419 "the main namespace in the future. Use an array with a string "
420 "or bytes dtype instead.", DeprecationWarning, stacklevel=2)

AttributeError: np.NINF was removed in the NumPy 2.0 release. Use -np.inf instead.

@Ontheroad123
Copy link

modofied 655 "max_score = np.NINF" to "max_score = np.inf"

@shobhit120801
Copy link

modofied 655 "max_score = np.NINF" to "max_score = np.inf"

do we have to change it manually ?

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

3 participants