maxpumperla / hyperas

Keras + Hyperopt: A very simple wrapper for convenient hyperparameter optimization
http://maxpumperla.com/hyperas/
MIT License
2.17k stars 316 forks source link

cannot import name 'conditional' from 'hyperas.distributions' #227

Closed last2win closed 5 years ago

last2win commented 5 years ago

i use other people's code:

from __future__ import print_function

from hyperopt import Trials, STATUS_OK, tpe
from keras.datasets import mnist
from keras.layers.core import Dense, Dropout, Activation
from keras.models import Sequential
from keras.utils import np_utils

from hyperas import optim
from hyperas.distributions import choice, uniform, conditional

and error occured:

Traceback (most recent call last):

  File "<ipython-input-1-77a51f029857>", line 10, in <module>
    from hyperas.distributions import choice, uniform, conditional

ImportError: cannot import name 'conditional' from 'hyperas.distributions' (C:\Users\peter\Anaconda3\lib\site-packages\hyperas\distributions.py)

i tryed:

pip uninstall hyperas
pip install git+https://github.com/maxpumperla/hyperas.git
pip uninstall hyperopt
pip install git+https://github.com/hyperopt/hyperopt.git

but the problem is still there.

maxpumperla commented 5 years ago

conditional is definitely gone from master and the last release (if I remember correctly). You can get rid of the error by removing all the conditional calls from "other people's code". :D

last2win commented 5 years ago

ok, i solved the problem.

ljakupi commented 5 years ago

@maxpumperla what's the alternative for conditional as it is removed?

E.g. what could be the solution to such cases: if conditional({{choice(['three', 'four'])}}) == 'four': ....

... well, one could be: if {{choice(['three', 'four'])}} == 'four': ...

BetterTogetherX commented 5 years ago

@zhang0peter ,How to solve it

last2win commented 5 years ago

@zhang0peter ,How to solve it

i delete conditional

cklat commented 4 years ago

is there any solution/alternative for conditional? I have basically the same code snippet that @ljakupi has posted for optimizing the number of layers of the trained network. However, since conditional was dropped, I'm wondering how to realize this pipeline (i.e. optimizing for number of layers)