skopt.utils.point_asdict

skopt.utils.point_asdict(search_space, point_as_list)[source][source]

Convert the list representation of a point from a search space to the dictionary representation, where keys are dimension names and values are corresponding to the values of dimensions in the list.

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_listlist

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

Returns
params_dictOrderedDict

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

Examples

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