adaptive icon indicating copy to clipboard operation
adaptive copied to clipboard

AverageLearners in a BalancingLearner don't work well

Open basnijholt opened this issue 5 years ago • 2 comments

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?

basnijholt avatar Jun 18 '19 20:06 basnijholt

Would only using atol work?

akhmerov avatar Jun 18 '19 20:06 akhmerov

With atol it does work but I am not sure if that's good enough.

basnijholt avatar Jun 20 '19 19:06 basnijholt