@@ -59,8 +59,8 @@ def default_loss(simplex, ys):
5959def choose_point_in_simplex (simplex , transform = None ):
6060 """Choose a new point in inside a simplex.
6161
62- Pick the center of the simplex if the shape is nice (that is, the
63- circumcenter lies within the simplex). Otherwise take the middle of the
62+ Pick the center of the simplex if the shape is nice (that is, the
63+ circumcenter lies within the simplex). Otherwise take the middle of the
6464 longest edge.
6565
6666 Parameters
@@ -94,7 +94,7 @@ def choose_point_in_simplex(simplex, transform=None):
9494
9595 if transform is not None :
9696 point = np .linalg .solve (transform , point ) # undo the transform
97-
97+
9898 return point
9999
100100
@@ -180,7 +180,7 @@ def __init__(self, func, bounds, loss_per_simplex=None):
180180 # create a private random number generator with fixed seed
181181 self ._random = random .Random (1 )
182182
183- # all real triangles that have not been subdivided and the pending
183+ # all real triangles that have not been subdivided and the pending
184184 # triangles heap of tuples (-loss, real simplex, sub_simplex or None)
185185
186186 # _simplex_queue is a heap of tuples (-loss, real_simplex, sub_simplex)
@@ -268,7 +268,7 @@ def _simplex_exists(self, simplex):
268268
269269 def inside_bounds (self , point ):
270270 return all (mn <= p <= mx for p , (mn , mx ) in zip (point , self .bounds ))
271-
271+
272272 def tell_pending (self , point , * , simplex = None ):
273273 point = tuple (point )
274274 if not self .inside_bounds (point ):
@@ -354,21 +354,21 @@ def _pop_highest_existing_simplex(self):
354354 # find the simplex with the highest loss, we do need to check that the
355355 # simplex hasn't been deleted yet
356356 while len (self ._simplex_queue ):
357- loss , simplex , subsimplex = heapq .heappop (self ._simplex_queue )
357+ loss , simplex , subsimplex = heapq .heappop (self ._simplex_queue )
358358 if (subsimplex is None
359- and simplex in self .tri .simplices
360- and simplex not in self ._subtriangulations ):
359+ and simplex in self .tri .simplices
360+ and simplex not in self ._subtriangulations ):
361361 return abs (loss ), simplex , subsimplex
362362 if (simplex in self ._subtriangulations
363- and simplex in self .tri .simplices
364- and subsimplex in self ._subtriangulations [simplex ].simplices ):
363+ and simplex in self .tri .simplices
364+ and subsimplex in self ._subtriangulations [simplex ].simplices ):
365365 return abs (loss ), simplex , subsimplex
366366
367367 # Could not find a simplex, this code should never be reached
368368 assert self .tri is not None
369369 raise AssertionError (
370- "Could not find a simplex to subdivide. Yet there should always be"
371- "a simplex available if LearnerND.tri() is not None."
370+ "Could not find a simplex to subdivide. Yet there should always"
371+ " be a simplex available if LearnerND.tri() is not None."
372372 )
373373
374374 def _ask_best_point (self ):
@@ -435,8 +435,8 @@ def update_losses(self, to_delete: set, to_add: set):
435435 heapq .heappush (self ._simplex_queue , (- loss , simplex , None ))
436436 continue
437437
438- self ._update_subsimplex_losses (simplex ,
439- self ._subtriangulations [simplex ].simplices )
438+ self ._update_subsimplex_losses (
439+ simplex , self ._subtriangulations [simplex ].simplices )
440440
441441 def losses (self ):
442442 """Get the losses of each simplex in the current triangulation, as dict
0 commit comments