Skip to content

Commit b06c2d4

Browse files
fmfnfmfn
authored andcommitted
Fix bounds-key ordering inconsistency
Bounds matrix was being created without sorting for keys first. This made things quite inconsistent. This commit fixes it.
1 parent c7accf5 commit b06c2d4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

bayes_opt/target_space.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ def __init__(self, target_func, pbounds: dict, random_state=None):
4444
# Get the name of the parameters
4545
self._keys = sorted(pbounds)
4646
# Create an array with parameters bounds
47-
self._bounds = np.array(list(pbounds.values()), dtype=np.float)
47+
self._bounds = np.array(
48+
[item[1] for item in sorted(pbounds.items(), key=lambda x: x[0])],
49+
dtype=np.float
50+
)
4851

4952
# preallocated memory for X and Y points
5053
self._x = np.empty(shape=(0, self.dim))

0 commit comments

Comments
 (0)