skopt.utils.point_aslist

skopt.utils.point_aslist(search_space, point_as_dict)[source][source]

Convert a dictionary representation of a point from a search space to the list representation. The list of values is created from the values of the dictionary, sorted by the names of dimensions used as 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)

point_as_dictdict

dict with parameter names as keys to which corresponding parameter values are assigned.

Returns
point_as_listlist

list with point values.The order of parameters in the list is given by sorted(params_space.keys()).

Examples

>>> from skopt.space.space import Real, Integer
>>> from skopt.utils import point_aslist
>>> search_space = {'name1': Real(0,1),
...                 'name2': Integer(2,4), 'name3': Real(-1,1)}
>>> point_as_dict = {'name1': 0.66, 'name2': 3, 'name3': -0.15}
>>> point_aslist(search_space, point_as_dict)
[0.66, 3, -0.15]