Skip to content
Snippets Groups Projects
Commit be74ad62 authored by Bas Nijholt's avatar Bas Nijholt
Browse files

round the losses to 12 digits to make them equal

Then equal losses will be sorted on x-coordinates.
parent c589a2f6
No related branches found
No related tags found
1 merge request!135test all the different loss functions in each test
......@@ -563,8 +563,13 @@ class Learner1D(BaseLearner):
def finite_loss(loss, xs):
# If the loss is infinite we return the
# distance between the two points.
return (loss if not math.isinf(loss)
else (xs[1] - xs[0]) / self._scale[0])
if math.isinf(loss):
loss = (xs[1] - xs[0]) / self._scale[0]
# We round the loss to 12 digits such that losses
# are equal up to numerical precision will be considered
# equal.
return round(loss, ndigits=12)
quals = [(-finite_loss(loss, x), x, 1)
for x, loss in self.losses_combined.items()]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment