Total Complexity | 2 |
Total Lines | 17 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | """Common functions used by multiple optimizers.""" |
||
2 | |||
3 | __all__ = ["_score_params"] |
||
4 | |||
5 | |||
6 | def _score_params(params, meta): |
||
7 | """Score parameters, used in parallelization.""" |
||
8 | meta = meta.copy() |
||
9 | experiment = meta["experiment"] |
||
10 | error_score = meta["error_score"] |
||
11 | |||
12 | try: |
||
13 | return experiment(**params) |
||
14 | except Exception: # noqa: B904 |
||
15 | # Catch all exceptions and assign error_score |
||
16 | return error_score |
||
17 |