deephyper.skopt.utils.dimensions_aslist

deephyper.skopt.utils.dimensions_aslist#

deephyper.skopt.utils.dimensions_aslist(search_space)[source]#

Convert a dict representation of a search space into a list of dimensions.

The list is ordered by sorted(search_space.keys()).

Parameters:

search_space (dict) – Represents search space. The keys are dimension names (strings) and values are instances of classes that inherit from the class deephyper.skopt.space.Dimension (Real, Integer or Categorical).

Returns:

list of deephyper.skopt.space.Dimension instances.

Return type:

params_space_list (list)

Examples:#

>>> from deephyper.skopt.space.space import Real, Integer
>>> from deephyper.skopt.utils import dimensions_aslist
>>> search_space = {'name1': Real(0,1),
...                 'name2': Integer(2,4), 'name3': Real(-1,1)}
>>> dimensions_aslist(search_space)[0]
Real(low=0, high=1, prior='uniform', transform='identity')
>>> dimensions_aslist(search_space)[1]
Integer(low=2, high=4, prior='uniform', transform='identity')
>>> dimensions_aslist(search_space)[2]
Real(low=-1, high=1, prior='uniform', transform='identity')