maxpumperla / hyperas

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

Wrong number of Layers in parts/space when tuning number of Layers #253

Open loublock opened 5 years ago

loublock commented 5 years ago

According to issue #204 the number of layers could be tuned by a for-loop

model = ...
num_layers = <result of randint>
for _ in range(num_layers):
        model.add(Dense({{choice([np.power(2,5),np.power(2,9),np.power(2,11)])}}))
        model.add(Activation({{choice(['tanh','relu', 'sigmoid'])}}))
        model.add(Dropout({{uniform(0, 1)}}))

But the layers added in the for-loop are missing when you look in the spaceobject. This is because hyperparameter_names(model_string) is not able to find the string parts in mode_string.