rsteca / sklearn-deap

Use evolutionary algorithms instead of gridsearch in scikit-learn
MIT License
771 stars 131 forks source link

Can't instantiate abstract class EvolutionaryAlgorithmSearchCV with abstract methods _run_search #57

Closed dongchirua closed 6 years ago

dongchirua commented 6 years ago

I use Python 2.7.15 to run test.py and I found an error TypeError: Can't instantiate abstract class EvolutionaryAlgorithmSearchCV with abstract methods _run_search

Would you please help correct anything I missed, bellow is all packages I installed

Package                            Version
---------------------------------- -----------
appdirs                            1.4.3
appnope                            0.1.0
asn1crypto                         0.24.0
attrs                              18.2.0
Automat                            0.7.0
backports-abc                      0.5
backports.shutil-get-terminal-size 1.0.0
bleach                             2.1.4
certifi                            2018.8.24
cffi                               1.11.5
configparser                       3.5.0
constantly                         15.1.0
cryptography                       2.3.1
Cython                             0.28.5
deap                               1.2.2
decorator                          4.3.0
entrypoints                        0.2.3
enum34                             1.1.6
functools32                        3.2.3.post2
futures                            3.2.0
html5lib                           1.0.1
hyperlink                          18.0.0
idna                               2.7
incremental                        17.5.0
ipaddress                          1.0.22
ipykernel                          4.10.0
ipython                            5.8.0
ipython-genutils                   0.2.0
ipywidgets                         7.4.2
Jinja2                             2.10
jsonschema                         2.6.0
jupyter                            1.0.0
jupyter-client                     5.2.3
jupyter-console                    5.2.0
jupyter-core                       4.4.0
MarkupSafe                         1.0
mistune                            0.8.3
mkl-fft                            1.0.6
mkl-random                         1.0.1
nbconvert                          5.3.1
nbformat                           4.4.0
notebook                           5.6.0
numpy                              1.15.2
pandas                             0.23.4
pandocfilters                      1.4.2
pathlib2                           2.3.2
pexpect                            4.6.0
pickleshare                        0.7.4
pip                                10.0.1
prometheus-client                  0.3.1
prompt-toolkit                     1.0.15
ptyprocess                         0.6.0
pyasn1                             0.4.4
pyasn1-modules                     0.2.2
pycparser                          2.19
Pygments                           2.2.0
pyOpenSSL                          18.0.0
python-dateutil                    2.7.3
pytz                               2018.5
pyzmq                              17.1.2
qtconsole                          4.4.1
scandir                            1.9.0
scikit-learn                       0.20.0
scipy                              1.1.0
Send2Trash                         1.5.0
service-identity                   17.0.0
setuptools                         40.2.0
simplegeneric                      0.8.1
singledispatch                     3.4.0.3
six                                1.11.0
sklearn-deap                       0.2.2
terminado                          0.8.1
testpath                           0.3.1
tornado                            5.1.1
traitlets                          4.3.2
Twisted                            17.5.0
wcwidth                            0.1.7
webencodings                       0.5.1
wheel                              0.31.1
widgetsnbextension                 3.4.2
zope.interface                     4.5.0
jarlva commented 5 years ago

I have the same problem on Python 3.6.6. I see above "Merged" but following the link does not hint a solution. Can someone please clarify what the solution is?

rsteca commented 5 years ago

@jheffez hi! I merged the pull request but it's not on pypi yet. Maybe you can clone the master branch and install it from there?

jarlva commented 5 years ago

Can you please be a bit more specific so I'm sure I'm doing the correct check? Thanks.

jarlva commented 5 years ago

did pip install -U git+https://github.com/rsteca/sklearn-deap.git. Seems to fix the initial problem but now getting a lot more below. After the errors jupyter cell just sits there with the asterisk and cpu does nothing.

Jupyter output: Types [1, 1, 1] and maxint [1, 3, 2] detected --- Evolve in 24 possible combinations ---

Console output: Process SpawnPoolWorker-13: Traceback (most recent call last): File "C:\Users\userx\AppData\Local\Programs\Python\Python36\lib\multiprocessing\process.py", line 258, in _bootstrap self.run() File "C:\Users\userx\AppData\Local\Programs\Python\Python36\lib\multiprocessing\process.py", line 93, in run self._target(*self._args, self._kwargs) File "C:\Users\userx\AppData\Local\Programs\Python\Python36\lib\multiprocessing\pool.py", line 108, in worker task = get() File "C:\Users\userx\AppData\Local\Programs\Python\Python36\lib\multiprocessing\queues.py", line 337, in get return _ForkingPickler.loads(res) AttributeError: Can't get attribute 'Individual' on <module 'deap.creator' from 'c:\users\userx\py\36env\lib\site-packages\deap\creator.py'> Process SpawnPoolWorker-14: Traceback (most recent call last): File "C:\Users\userx\AppData\Local\Programs\Python\Python36\lib\multiprocessing\process.py", line 258, in _bootstrap self.run() File "C:\Users\userx\AppData\Local\Programs\Python\Python36\lib\multiprocessing\process.py", line 93, in run self._target(*self._args, *self._kwargs) File "C:\Users\userx\AppData\Local\Programs\Python\Python36\lib\multiprocessing\pool.py", line 108, in worker task = get() File "C:\Users\userx\AppData\Local\Programs\Python\Python36\lib\multiprocessing\queues.py", line 337, in get return _ForkingPickler.loads(res) AttributeError: Can't get attribute 'Individual' on <module 'deap.creator' from 'c:\users\userx\py\36env\lib\site-packages\deap\creator.py'> Process SpawnPoolWorker-15: Traceback (most recent call last): File "C:\Users\userx\AppData\Local\Programs\Python\Python36\lib\multiprocessing\process.py", line 258, in _bootstrap self.run() File "C:\Users\userx\AppData\Local\Programs\Python\Python36\lib\multiprocessing\process.py", line 93, in run self._target(self._args, self._kwargs) File "C:\Users\userx\AppData\Local\Programs\Python\Python36\lib\multiprocessing\pool.py", line 108, in worker task = get() File "C:\Users\userx\AppData\Local\Programs\Python\Python36\lib\multiprocessing\queues.py", line 337, in get return _ForkingPickler.loads(res) AttributeError: Can't get attribute 'Individual' on <module 'deap.creator' from 'c:\users\userx\py\36env\lib\site-packages\deap\creator.py'> Process SpawnPoolWorker-16: Traceback (most recent call last): File "C:\Users\userx\AppData\Local\Programs\Python\Python36\lib\multiprocessing\process.py", line 258, in _bootstrap self.run() File "C:\Users\userx\AppData\Local\Programs\Python\Python36\lib\multiprocessing\process.py", line 93, in run self._target(*self._args, *self._kwargs) File "C:\Users\userx\AppData\Local\Programs\Python\Python36\lib\multiprocessing\pool.py", line 108, in worker task = get() File "C:\Users\userx\AppData\Local\Programs\Python\Python36\lib\multiprocessing\queues.py", line 337, in get return _ForkingPickler.loads(res) AttributeError: Can't get attribute 'Individual' on <module 'deap.creator' from 'c:\users\userx\py\36env\lib\site-packages\deap\creator.py'> c:\users\userx\py\36env\lib\site-packages\sklearn\externals\joblib\externals\cloudpickle\cloudpickle.py:47: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses import imp Process SpawnPoolWorker-17: Traceback (most recent call last): File "C:\Users\userx\AppData\Local\Programs\Python\Python36\lib\multiprocessing\process.py", line 258, in _bootstrap self.run() File "C:\Users\userx\AppData\Local\Programs\Python\Python36\lib\multiprocessing\process.py", line 93, in run self._target(self._args, **self._kwargs) File "C:\Users\userx\AppData\Local\Programs\Python\Python36\lib\multiprocessing\pool.py", line 108, in worker task = get() File "C:\Users\userx\AppData\Local\Programs\Python\Python36\lib\multiprocessing\queues.py", line 337, in get return _ForkingPickler.loads(res) AttributeError: Can't get attribute 'Individual' on <module 'deap.creator' from 'c:\users\userx\py\36env\lib\site-packages\deap\creator.py'>

jarlva commented 5 years ago

Update: disabled multiprocessing using: n_jobs=1 and was able to get results without console errors. Any thought?

rsteca commented 5 years ago

Hi! I think multiprocessing doesn't work on windows, but I have never tried it on that platform.