Nested parameters in hyperopt 0.2.4

527 views Asked by At

I wanted to do a search of parameters in which one of them is dependent on the other, very similar to what is described on this StackOverflow question, but when I run I get the issue below:

TypeError: len of pyll.Apply either undefined or unknown

Reading the comments on the questions looks like this changed in version 0.2.3 of hyperopt. Any idea how to deal with this sort of issue on the current version? The code below reproduces de error I'm facing.

from hyperopt import fmin, tpe, hp, STATUS_OK

def f(x):
    return {'loss': x['foo']*x['bar'], 'status':STATUS_OK}


_foo = hp.uniform('foo', 0, 1)
_bar = hp.uniform('bar', _foo, 1)

space = {
    'foo': _foo,
    'bar': _bar
}

best = fmin(
    f,
    space=space,
    max_evals=100,
    algo=tpe.suggest
)
print(best)
0

There are 0 answers