Open
Description
In a BalancingLearner
where one of the learners returns contant+-eps
(where eps < 1e-15) the points are not correctly balanced over the learners. The one that returns 0 (or a constant) might have values that are relatively exponentially larger but in absolute terms almost the same.
For example:
import adaptive
adaptive.notebook_extension()
def f(x):
import random
return random.gauss(1, 1)
def constant(x):
import random
return random.gauss(1, 1) * 10**-random.randint(50, 200)
learners = [adaptive.AverageLearner(f, rtol=0.01), adaptive.AverageLearner(constant, rtol=0.01)]
learner = adaptive.BalancingLearner(learners)
runner = adaptive.runner.simple(learner, goal=lambda l: l.learners[0].npoints > 2000)
print(learners[0].npoints, learners[1].npoints)
2001 12769
@akhmerov or @jbweston do you have an idea how to solve this?