Skip to content

Commit 44f18fd

Browse files
committed
clamp variances to be positive in get_infeasible_cost
Summary: The posterior variance can be slightly negative due to numerical issues. This can lead to NaNs in the infeasible cost. This clamps the variance in the computation to be non-negative to avoid this. (I guess the alternative would be to clamp this directly in the `posterior` method) Reviewed By: danielrjiang Differential Revision: D14846840 fbshipit-source-id: bbfebfbcd60c38afb4b107812ff7ab39b91843e3
1 parent 6e1395d commit 44f18fd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

botorch/acquisition/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,6 @@ def get_infeasible_cost(
113113
The infeasible cost M value.
114114
"""
115115
posterior = model.posterior(X)
116-
lb = objective(posterior.mean - 6 * posterior.variance.sqrt()).min()
116+
lb = objective(posterior.mean - 6 * posterior.variance.clamp_min(0).sqrt()).min()
117117
M = -lb.clamp_max(0.0)
118118
return M.item()

0 commit comments

Comments
 (0)