First of all, thanks to the whole Ray team for the amazing job they are doing!
My intention is to optimize the number of Conv1D layers and the kernel size in each layer using PBT and Keras, therefore, I assume my hyperparam_mutations should take the form like -
“layers” : tune.choice([2,3,4,5,6]),
“kernels”: {0:[3,5,7],1:[3,5,7] … n:[3,5,7]}, where n is number of “layers” - so it should be different length depending on number of “layers”
Is it possible to achieve?
I tried many things, for instance setting both config and hyperparam_mutations as follows:
hp = {
“layers” : tune.choice([2,3,4,5]),
“kernels” : lambda spec : { il : tune.choice([3,5,7]) for il in range(spec.config[‘layers’]) } }
in create_model(hp) I call it as
for layer in range(hp[‘layers’]):
x=Conv1D(64,kernel_size=hp[‘kernels’][layer], … )(x)
in this particular case the I get an error: TypeError: ‘function’ object is not subscriptable.
I would appreciate any clue on how I can approach this.
Thanks!
Best,
Yevhen