MCPcopy
hub / github.com/hyperopt/hyperopt / expr_to_config

Function expr_to_config

hyperopt/pyll_utils.py:186–208  ·  view source on GitHub ↗

Populate dictionary `hps` with the hyperparameters in pyll graph `expr` and conditions for participation in the evaluation of `expr`. Arguments: expr - a pyll expression root. conditions - a tuple of conditions (`Cond`) that must be True for `expr` to be

(expr, conditions, hps)

Source from the content-addressed store, hash-verified

184
185
186def expr_to_config(expr, conditions, hps):
187 """
188 Populate dictionary `hps` with the hyperparameters in pyll graph `expr`
189 and conditions for participation in the evaluation of `expr`.
190
191 Arguments:
192 expr - a pyll expression root.
193 conditions - a tuple of conditions (`Cond`) that must be True for
194 `expr` to be evaluated.
195 hps - dictionary to populate
196
197 Creates `hps` dictionary:
198 label -> { 'node': apply node of hyperparameter distribution,
199 'conditions': `conditions` + tuple,
200 'label': label
201 }
202 """
203 expr = as_apply(expr)
204 if conditions is None:
205 conditions = ()
206 assert isinstance(expr, Apply)
207 _expr_to_config(expr, conditions, hps)
208 _remove_allpaths(hps, conditions)
209
210
211def _remove_allpaths(hps, conditions):

Callers 4

test_expr_to_configFunction · 0.90
test_remove_allpathsFunction · 0.90
test_remove_allpaths_intFunction · 0.90
dot_hyperparametersFunction · 0.85

Calls 3

as_applyFunction · 0.85
_expr_to_configFunction · 0.85
_remove_allpathsFunction · 0.85

Tested by 3

test_expr_to_configFunction · 0.72
test_remove_allpathsFunction · 0.72
test_remove_allpaths_intFunction · 0.72