Browse code

1D: always return the points as a list

Bas Nijholt authored on 11/07/2018 00:23:27
Showing 1 changed files
... ...
@@ -251,7 +251,6 @@ class Learner1D(BaseLearner):
251 251
 
252 252
             self._oldscale = deepcopy(self._scale)
253 253
 
254
-
255 254
     def ask(self, n, add_data=True):
256 255
         """Return n points that are expected to maximally reduce the loss."""
257 256
         # Find out how to divide the n points over the intervals
... ...
@@ -273,11 +272,11 @@ class Learner1D(BaseLearner):
273 272
         if len(points) == 2:
274 273
             # First time
275 274
             loss_improvements = [np.inf] * n
276
-            points = np.linspace(*self.bounds, n)
275
+            points = np.linspace(*self.bounds, n).tolist()
277 276
         elif len(points) == 1:
278 277
             # Second time, if we previously returned just self.bounds[0]
279 278
             loss_improvements = [np.inf] * n
280
-            points = np.linspace(*self.bounds, n + 1)[1:]
279
+            points = np.linspace(*self.bounds, n + 1)[1:].tolist()
281 280
         else:
282 281
             def xs(x, n):
283 282
                 if n == 1:
... ...
@@ -336,7 +335,6 @@ class Learner1D(BaseLearner):
336 335
 
337 336
         return p.redim(x=dict(range=plot_bounds))
338 337
 
339
-
340 338
     def remove_unfinished(self):
341 339
         self.pending_points = set()
342 340
         self.losses_combined = deepcopy(self.losses)