hyperas icon indicating copy to clipboard operation
hyperas copied to clipboard

Error if no hyperparameter search before choice between different models

Open komodovaran opened this issue 5 years ago • 1 comments

Using the frontpage complete MNIST example, the below only works if some hyperparameter search is added after Sequential

model = Sequential()

model.add(Dense({{choice([100, 200])}})) # This works
# model.add(Activation({{choice([None])}})) # This also works. Yes, it's commented out!

if {{choice(['mdl1', 'mdl2'])}} == 'mdl1':
    model.add(Dense({{choice([100, 200])}}))
    model.add(Activation('relu'))
else:
    model.add(Dense({{choice([100, 200])}}))
    model.add(Activation('relu'))

model.add(Dense(10))
model.add(Activation('softmax'))

Even commenting out the first line also works. But removing it entirely throws the classic IndexError: list index out of range.

komodovaran avatar Mar 07 '19 17:03 komodovaran

@Komodovaran thanks, this is an interesting edge case I actually never considered. good catch!

maxpumperla avatar Mar 08 '19 07:03 maxpumperla