@@ -50,7 +50,7 @@ def __init__(self, target_func, pbounds: dict, random_state=None):
5050 )
5151
5252 # preallocated memory for X and Y points
53- self ._x = np .empty (shape = (0 , self .dim ))
53+ self ._params = np .empty (shape = (0 , self .dim ))
5454 self ._target = np .empty (shape = (0 ))
5555
5656 # keep track of unique points we have seen so far
@@ -60,16 +60,16 @@ def __contains__(self, x):
6060 return _hashable (x ) in self ._cache
6161
6262 def __len__ (self ):
63- assert len (self ._x ) == len (self ._target )
63+ assert len (self ._params ) == len (self ._target )
6464 return len (self ._target )
6565
6666 @property
6767 def empty (self ):
6868 return len (self ) == 0
6969
7070 @property
71- def x (self ):
72- return self ._x
71+ def params (self ):
72+ return self ._params
7373
7474 @property
7575 def target (self ):
@@ -117,7 +117,7 @@ def _as_array(self, x):
117117 assert x .size == self .dim , 'x must have the same dimensions'
118118 return x
119119
120- def register (self , x , target ):
120+ def register (self , params , target ):
121121 """
122122 Append a point and its target value to the known data.
123123
@@ -150,17 +150,17 @@ def register(self, x, target):
150150 >>> len(space)
151151 1
152152 """
153- x = self ._as_array (x )
153+ x = self ._as_array (params )
154154 if x in self :
155155 raise KeyError ('Data point {} is not unique' .format (x ))
156156
157157 # Insert data into unique dictionary
158158 self ._cache [_hashable (x .ravel ())] = target
159159
160- self ._x = np .concatenate ([self ._x , x .reshape (1 , - 1 )])
160+ self ._params = np .concatenate ([self ._params , x .reshape (1 , - 1 )])
161161 self ._target = np .concatenate ([self ._target , [target ]])
162162
163- def probe (self , x ):
163+ def probe (self , params ):
164164 """
165165 Evaulates a single point x, to obtain the value y and then records them
166166 as observations.
@@ -179,7 +179,7 @@ def probe(self, x):
179179 y : float
180180 target function value.
181181 """
182- x = self ._as_array (x )
182+ x = self ._as_array (params )
183183
184184 try :
185185 target = self ._cache [_hashable (x )]
@@ -217,15 +217,17 @@ def max(self):
217217 try :
218218 res = {
219219 'target' : self .target .max (),
220- 'params' : dict (zip (self .keys , self .x [self .target .argmax ()]))
220+ 'params' : dict (
221+ zip (self .keys , self .params [self .target .argmax ()])
222+ )
221223 }
222224 except ValueError :
223225 res = {}
224226 return res
225227
226228 def res (self ):
227229 """Get all target values found and corresponding parametes."""
228- params = [dict (zip (self .keys , p )) for p in self .x ]
230+ params = [dict (zip (self .keys , p )) for p in self .params ]
229231
230232 return [
231233 {"target" : target , "params" : param }
0 commit comments