hyperopt icon indicating copy to clipboard operation
hyperopt copied to clipboard

Single condition for several parameters?

Open vladradishevsky opened this issue 6 years ago • 2 comments

How can I add my own condition for example:

a = hp.uniform('a', 0.0, 1.0) b = hp.uniform('b', 0.0, 1.0) c = hp.uniform('c', 0.0, 1.0)

And sum of a, b and c must be equal to one ?

vladradishevsky avatar Mar 01 '19 08:03 vladradishevsky

Use softmax in the function?

PhilipMay avatar Mar 01 '19 09:03 PhilipMay

One solution can be seen at https://github.com/hyperopt/hyperopt/issues/337 -- adding you own penalty. Anyhow, in the source it says that this approach was not too successful.

Another idea which comes to my mind is to guess a and b and later in the objective function you can derive c from both. But definitely this solution adds obvious further constraints and that might not be desirable.

a = hp.uniform('a', 0.0, 0.5)
b = hp.uniform('b', 0.0, 0.5)

You could of course also rescale the variables in the objective function by any means that guarantees the ranking (x1 < x2 => f(x1) < f(x2)) (also see the softmax approach). Still this might not be really smart because of the KDE approach which works on x1 instead of f(x1).

1kastner avatar Mar 12 '19 19:03 1kastner

This issue has been marked as stale because it has been open 120 days with no activity. Remove the stale label or comment or this will be closed in 30 days.

github-actions[bot] avatar Jun 02 '24 01:06 github-actions[bot]