skopt.utils.dimensions_aslist

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

Convert a dict representation of a search space into a list of dimensions, ordered by sorted(search_space.keys()).

Parameters
search_spacedict

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

Returns
params_space_list: list

list of skopt.space.Dimension instances.

Examples

>>> from skopt.space.space import Real, Integer
>>> from 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')