Skip to content

Commit aeb46b9

Browse files
ScienfitzCopilot
andauthored
Improve validation in from_simplex
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent cce898a commit aeb46b9

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

baybe/searchspace/discrete.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,11 @@ def from_simplex(
392392
# negative coefficient the ordering flips and it becomes c*max_raw. Taking
393393
# min of both products handles any real coefficient correctly.
394394
coeffs = np.asarray(simplex_coefficients, dtype=float)
395+
if not np.isfinite(coeffs).all():
396+
raise ValueError(
397+
f"All simplex_coefficients passed to '{cls.from_simplex.__name__}' "
398+
f"must be finite numbers."
399+
)
395400
min_weighted = np.array(
396401
[min(c * lo, c * hi) for c, lo, hi in zip(coeffs, min_raw, max_raw)]
397402
)

0 commit comments

Comments
 (0)