dml_util#
DaggerML utilities.
- dml_util.dict_product(d)[source]#
Given a dictionary of lists, yield all possible combinations of the lists. Good for grid searches.
- Parameters:
d (dict) – A dictionary where the keys are strings and the values are lists. The keys represent the names of the parameters, and the values are the possible values for those parameters.
- Yields:
dict – A dictionary representing a single combination of parameter values. The keys are the same as the input dictionary, and the values are the corresponding values from the input lists.
Examples
>>> d = {'a': [1, 2], 'b': ['x', 'y']} >>> for combination in dict_product(d): ... print(combination) {'a': 1, 'b': 'x'} {'a': 1, 'b': 'y'} {'a': 2, 'b': 'x'} {'a': 2, 'b': 'y'}
Modules