We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c589a2f commit be74ad6Copy full SHA for be74ad6
adaptive/learner/learner1D.py
@@ -563,8 +563,13 @@ def _ask_points_without_adding(self, n):
563
def finite_loss(loss, xs):
564
# If the loss is infinite we return the
565
# distance between the two points.
566
- return (loss if not math.isinf(loss)
567
- else (xs[1] - xs[0]) / self._scale[0])
+ if math.isinf(loss):
+ loss = (xs[1] - xs[0]) / self._scale[0]
568
+
569
+ # We round the loss to 12 digits such that losses
570
+ # are equal up to numerical precision will be considered
571
+ # equal.
572
+ return round(loss, ndigits=12)
573
574
quals = [(-finite_loss(loss, x), x, 1)
575
for x, loss in self.losses_combined.items()]
0 commit comments