Closed tam-nguyenminh closed 4 weeks ago
modofied 655 "max_score = np.NINF" to "max_score = np.inf"
modofied 655 "max_score = np.NINF" to "max_score = np.inf"
do we have to change it manually ?
Hey @shobhit120801 I ran into the exact same error as you. @Ontheroad123 I did update the source code manually to np.inf or even -np.inf and neither work. I keep getting the same error above even though I have updated the source code
I don't know anything about codes Brad
On Tue, Oct 15, 2024, 3:04 PM Christie-Rose Woodside < @.***> wrote:
Hey @shobhit120801 https://github.com/shobhit120801 I ran into the exact same error as you. @Ontheroad123 https://github.com/Ontheroad123 I did update the source code manually to np.inf or even -np.inf and neither work. I keep getting the same error above even though I have updated the source code
— Reply to this email directly, view it on GitHub https://github.com/rasbt/mlxtend/issues/1100#issuecomment-2414901197, or unsubscribe https://github.com/notifications/unsubscribe-auth/BFXOEMCEV6JAV6ZLAVGDA3DZ3VYNPAVCNFSM6AAAAABJ3MTS7WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMJUHEYDCMJZG4 . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Hey @shobhit120801 I ran into the exact same error as you. @Ontheroad123 I did update the source code manually to np.inf or even -np.inf and neither work. I keep getting the same error above even though I have updated the source code
@cwoodside1278 It worked for me, but you need to replace two lines in the source code:
def finalize_fit(self):
max_score = -np.inf # changed
...
k_score = max_score
if k_score == -np.inf: # changed
...
If anyone of you needs help with this, let me know. I can also push a PR on this.
What finally worked for you guys ?
I ran into the exact same issue as @tam-nguyenminh
sfs_forward = SFS(linear_model,
k_features='best',
forward=True,
floating=False,
scoring='neg_mean_squared_error',
cv=5)
sfs_forward = sfs_forward.fit(predictor_variables, dependent_variable) # --->
#🔴This line has an error (AttributeError: `np.NINF` was removed in the NumPy 2.0 release. Use `-np.inf` instead.Cell Execution Error)
I am not sure what to update
to make it work. @d-kleine
You need to edit the source code, as provided above.
Clone the repo locally, apply the changes - or checkout my PR at gh pr checkout 1107
locally. Then install the repo locally, e.g. pip install ./mlxtend
(open a command shell, activate the relevant Python env, nagivate to the working dir where the cloned mlxtend
folder is located in, e.g. your Desktop, and then execute the command)
A new version of mlxtend
has just been released (0.23.2), you can update it via pip install --upgrade mlxtend
. Once updated, above error message should not pop up anymore.
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](file:///C:/Users/84393/miniconda3/envs/venv_ds/Lib/site-packages/numpy/init.py:411) raise AttributeError( 412 f"
np.{attr}
was removed in the NumPy 2.0 release. " [413](file:///C:/Users/84393/miniconda3/envs/venv_ds/Lib/site-packages/numpy/init.py:413) f"{expired_attributes[attr]}" 414 ) [416](file:///C:/Users/84393/miniconda3/envs/venv_ds/Lib/site-packages/numpy/init.py:416) if attr == "chararray": 417 warnings.warn( [418](file:///C:/Users/84393/miniconda3/envs/venv_ds/Lib/site-packages/numpy/init.py:418) "np.chararray
is deprecated and will be removed from " 419 "the main namespace in the future. Use an array with a string " [420](file:///C:/Users/84393/miniconda3/envs/venv_ds/Lib/site-packages/numpy/init__.py:420) "or bytes dtype instead.", DeprecationWarning, stacklevel=2)AttributeError:
np.NINF
was removed in the NumPy 2.0 release. Use-np.inf
instead.