Skip to content

Commit 84380fe

Browse files
committed
suggested fix to #394
1 parent 202dc3c commit 84380fe

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

bayes_opt/domain_reduction.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,19 @@ def _trim(self, new_bounds: np.array, global_bounds: np.array) -> np.array:
105105
new_bounds[i, 1] = entry[0]
106106
window_width = abs(entry[0] - entry[1])
107107
if window_width < self.minimum_window[i]:
108-
new_bounds[i, 0] -= (self.minimum_window[i] - window_width) / 2.0
109-
new_bounds[i, 1] += (self.minimum_window[i] - window_width) / 2.0
110-
108+
dw = (self.minimum_window[i] - window_width) / 2.0
109+
new_bounds[i, 0] -= dw
110+
new_bounds[i, 1] += dw
111+
# left_expansion_space = abs(global_bounds[i, 0] - entry[0]) # should be non-positive
112+
# right_expansion_space = abs(global_bounds[i, 1] - entry[1]) # should be non-negative
113+
# # conservative
114+
# dw_l = min(dw, left_expansion_space)
115+
# dw_r = min(dw, right_expansion_space)
116+
# # this crawls towards the edge
117+
# ddw_r = dw_r + max(dw - dw_l, 0)
118+
# ddw_l = dw_l + max(dw - dw_r, 0)
119+
# new_bounds[i, 0] -= ddw_l
120+
# new_bounds[i, 1] += ddw_r
111121
return new_bounds
112122

113123
def _create_bounds(self, parameters: dict, bounds: np.array) -> dict:

0 commit comments

Comments
 (0)