talos icon indicating copy to clipboard operation
talos copied to clipboard

Skip certain parameter combinations in the parameter space

Open Smolky opened this issue 4 years ago • 2 comments

1) I think Talos should add a method for skip impossible combinations of parameters

If for example, I want to test a CNN with MLP networks, some parameters, such as the kernel_size does not exists in certain combinations. Moreover, if I limit the time or the number of combinations I do not want to waste some impossible combinations.

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

Although there are methods for skip this manually, I think it should be nice to use parameter space in the same way that ParametersGrid from scikit-learn does.

For example:

parameters_to_evaluate = [{
     'number_of_layers': [1, 2, 3, 4, 5, 6, 7, 8],
     'first_neuron': [8, 16, 48, 64, 128, 256],
     'shape': ['funnel', 'brick'],
     'architecture': ['bilstm', 'bigru'],
      'activation': ['relu', 'sigmoid']
}, {
     'number_of_layers': [1, 2, 3, 4, 5, 6, 7, 8],
     'first_neuron': [8, 16, 48, 64, 128, 256],
     'shape': ['funnel', 'brick'],
     'kernel_size': [3, 5],
     'architecture': ['cnn'],
     'activation': ['relu', 'sigmoid']
}]

3) I believe this feature is

  • [ ] critically important
  • [ ] must have
  • [X ] nice to have

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

  • [ ] definitely
  • [ ] possibly
  • [X] unlikely

Smolky avatar Dec 23 '20 10:12 Smolky

Just to be safe...

You can achieve it with Scan( ... boolean_limit ... ) or a more custom way where the input model has something that tells Talos

Also, you can within the input model itself handle any logics you like. Talos will compute everything that is in the input model, regardless if it relates with tf/keras or not. This gives you unrestricted power to add any logic to the input model.

I do appreciate that there is a benefit in following a pattern by a library that benefits many in the Talos community. Thank you for suggesting it 👍

mikkokotila avatar Dec 30 '20 17:12 mikkokotila

Hi. Thanks for your answer. First, I have to thank you for this tool. It is very useful to me.

Before I post my suggestion, I considered the following approaches:

  1. Skip it inside the model, but I tried to return None, None but I think Talos expect both History and Model as output after each iteration. Moreover, I think that if you want to limit the permutations, this approach is not useful because if you set round_limit, Talos will not try as many combinations as it could.
  2. Specify, beforehand, the valid combinations. In this case, I remember that scikit allows list of dictionaries as inputs, but I have no idea how complex it this to implement with Talos.

Kind regards and happy new year

Smolky avatar Dec 30 '20 19:12 Smolky