-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Description
pycaret version checks
-
I have checked that this issue has not already been reported here.
-
I have confirmed this bug exists on the latest version of pycaret.
-
I have confirmed this bug exists on the master branch of pycaret (pip install -U git+https://github.com/pycaret/pycaret.git@master).
Issue Description
Hello!
I set feature_selection_estimator to use LGBClassifier(importance_type='gain') for feature selection, but an error occurred.
When I checked the code, it seems that the value of feature_selection_estimator that I set was only used for error checking in _feature_selection in "preprocessor.py" and was not used anywhere else.
Reproducible Example
exp.setup(data=train, target='tg', feature_selection=True, feature_selection_estimator=LGBMClassifier(importance_type='gain'))
Expected Behavior
Any estimator that can obtain feature_importance can be used to select features
Actual Results
Traceback (most recent call last):
File "C:\xxx\plugins\python-ce\helpers\pydev\pydevd.py", line 1491, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
File "C:\xxx\plugins\python-ce\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "C:/Users/xxx/ensemble_learning_2.py", line 158, in <module>
exp.setup(
File "C:\Users\xxx\venv310\lib\site-packages\pycaret\classification\oop.py", line 880, in setup
self._feature_selection(
File "C:\Users\xxx\venv310\lib\site-packages\pycaret\internal\preprocess\preprocessor.py", line 993, in _feature_selection
estimator=fs_estimator,
UnboundLocalError: local variable 'fs_estimator' referenced before assignment
Installed Versions
PyCaret 3.0.1