autonomio / talos

Hyperparameter Experiments with TensorFlow and Keras
https://autonom.io
MIT License
1.62k stars 270 forks source link

Multi independent hidden_layers used in a single model #440

Closed hep-beginner closed 4 years ago

hep-beginner commented 4 years ago

Thanks a lot for suggesting a feature to Talos. Please take a moment to go through the below checklist to provide context in a way that makes it easy to take your request forward.

1) I think Talos should add

The hidden_layers is a very cool and nice feature. Currently it looks the hidden_layers will get hard-coded key word for the feature inside parameters dictionary and this would have some restrictions in the use of hidden_layers. I would suggest to free the key words and enable the use of multi hidden layers refering to different parameter lists independently in one model.

2) Once implemented, I can see how this feature will

With this features, the researcher can use more flexible model optimization schemes and it can be more comfortable for broader scenarios.

3) I believe this feature is

4) Given the chance, I'd be happy to make a PR for this feature


mikkokotila commented 4 years ago

If I understand you correctly, the way I usually do it is with something like:

p = {'hidden_layers_1': [2, 3, 4, 5]}

def input_model(x_train, y_train, x_val, y_val, params):
  ...
  for i in range(params[hidden_layers_1]):
    model.add(Dense())
  ...

You could do this as many times as you liked and with as complex layer structures as you liked.

Would that work?