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)
| 184 | |
| 185 | |
| 186 | def 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 | |
| 211 | def _remove_allpaths(hps, conditions): |