Commit a452cbd
Validate all sympy-parsed inputs early with clear error messages (#5196)
Summary:
1. **`ax/core/parameter.py` (`DerivedParameter._parse_expression_str`)**: Wrapped bare `sympify()` call in try/except to convert `SympifyError` to `UserInputError` with a descriptive message.
2. **`ax/utils/common/sympy.py` (`parse_objective_expression`)**: Wrapped bare `sympify()` call in try/except to convert `SympifyError` to `UserInputError`.
3. **`ax_core_instantiation_utils.py` (`_make_objectives`)**: Migrated from `MultiObjective(objectives=[...])` to the new expression-based `Objective(expression=..., metric_name_to_signature=...)` API. This is a behavioral change: objectives are now constructed using a single `Objective` with a comma-separated expression string instead of wrapping individual `Objective` instances in a `MultiObjective`. The corresponding test in `base_utils_test.py` is updated to match.
Differential Revision: D1000580271 parent dd8b120 commit a452cbd
4 files changed
Lines changed: 33 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
1342 | 1342 | | |
1343 | 1343 | | |
1344 | 1344 | | |
1345 | | - | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
1346 | 1352 | | |
1347 | 1353 | | |
1348 | 1354 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
412 | 412 | | |
413 | 413 | | |
414 | 414 | | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
415 | 423 | | |
416 | 424 | | |
417 | 425 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1128 | 1128 | | |
1129 | 1129 | | |
1130 | 1130 | | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
1131 | 1142 | | |
1132 | 1143 | | |
1133 | 1144 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
104 | 109 | | |
105 | 110 | | |
106 | 111 | | |
| |||
0 commit comments