TPOT report error
Today when I ran a machine learning project using TPOT, it reported the error below:
D:\rebirth - default\venv_test\Lib\site-packages\tpot\builtins\__init__.py:36: UserWarning: Warning: optional dependency `torch` is not available.
- skipping import of NN models.
warnings.warn("Warning: optional dependency `torch` is not available. - skipping import of NN models.")
Generation 1 - Current best internal CV score: -inf
Traceback (most recent call last):
File "D:\rebirth - default\venv_test\Lib\site-packages\tpot\base.py", line 817, in fit
self._pop, _ = eaMuPlusLambda(
^^^^^^^^^^^^^^^
File "D:\rebirth - default\venv_test\Lib\site-packages\tpot\gp_deap.py", line 285, in eaMuPlusLambda
per_generation_function(gen)
File "D:\rebirth - default\venv_test\Lib\site-packages\tpot\base.py", line 1183, in _check_periodic_pipeline
self._update_top_pipeline()
File "D:\rebirth - default\venv_test\Lib\site-packages\tpot\base.py", line 935, in _update_top_pipeline
raise RuntimeError(
RuntimeError: There was an error in the TPOT optimization process. This could be because the data was not formatted properly, or because data for a regression problem was provided to the TPOTClassifier object. Please make sure you passed the data to TPOT correctly. If you enabled PyTorch estimators, please check the data requirements in the online documentation: https://epistasislab.github.io/tpot/using/
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "d:\rebirth - default\tpot优化.py", line 169, in <module>
tpot.fit(training_features, training_target)
File "D:\rebirth - default\venv_test\Lib\site-packages\tpot\base.py", line 864, in fit
raise e
File "D:\rebirth - default\venv_test\Lib\site-packages\tpot\base.py", line 855, in fit
self._update_top_pipeline()
File "D:\rebirth - default\venv_test\Lib\site-packages\tpot\base.py", line 935, in _update_top_pipeline
raise RuntimeError(
RuntimeError: There was an error in the TPOT optimization process. This could be because the data was not formatted properly, or because data for a regression problem was provided to the TPOTClassifier object. Please make sure you passed the data to TPOT correctly. If you enabled PyTorch estimators, please check the data requirements in the online documentation: https://epistasislab.github.io/tpot/using/
The code was successfully ran three months ago. But I updated the python libraries last week. I guess some updated libraries resulted in this error.
Assigned to Nick to keep visibility on the issue. Nick to take a look and decide if it needs to be assigned to someone else in the team.
I can confirm this. When I tried to run on my local machine using a fresh conda environment on Python 3.10.13, the code gave me the above error. However, when I ran it on a Kaggle environment, it worked.
After checking around, I tried reinstalling dependencies on my local environment with the versions on the kaggle environment and it worked locally.
These are the versions that worked for me:
pandas==2.2.0 numpy==1.24.4 matplotlib==3.7.4 seaborn==0.12.2 scikit-learn==1.2.2 scipy==1.11.4 TPOT==0.12.1 gplearn==0.4.2 torch==2.1.2 termcolor==2.4.0 sympy==1.12
Has the latest update resolved your issue? Should be working with the latest version of scikit-learn now
It has been solved. Thank you. :)