Hyperopt: Is there a way for a uniform integer search space?

Created on 4 Nov 2019  路  3Comments  路  Source: hyperopt/hyperopt

Hi,

from the methods for a search space I don't see a good way for uniform integer like

choice(1,2,3,4,5,6,...,100)

there is only randint but this includes 0 which is mostly bad for deep learning.

So I need like for the uniform function but for integers with a lower and upper bound and steps!

int_uniform(1,100,step=2)

Is it right only possible to handcraft it with choice?

Most helpful comment

thanks for sharing!
to define scope function:
from hyperopt.pyll import scope

All 3 comments

you can use hp.quniform to accomplish this

Something like scope.int(hp.quiniform('my_param', 1, 100, q=1)) will do the trick.

By default quniform returns a float, so the scope.int just converts it to an integer for you

Thank you!

thanks for sharing!
to define scope function:
from hyperopt.pyll import scope

Was this page helpful?
0 / 5 - 0 ratings