def h(x, offset=0):
a = 0.01
return x + a**2 / (a**2 + (x - offset)**2)
learners = [adaptive.Learner1D(partial(h, offset=random.uniform(-1, 1)),
bounds=(-1, 1)) for i in range(10)]
bal_learner = adaptive.BalancingLearner(learners)
bal_learner.ask(10)
([(0, -1),
(0, 1),
(0, 0.0),
(0, -0.5),
(0, 0.5),
(0, -0.75),
(0, -0.25),
(0, 0.25),
(0, 0.75),
(0, -0.875)],
[inf, inf, inf, inf, inf, inf, inf, inf, inf, inf])
Instead, it should balance the points over all learners. This happens because the loss improvements are inf for all points.
A temporary solution would be to force all learners to have the same amount of points by using:
bal_learner = adaptive.BalancingLearner(learners, strategy='npoints')
Instead, it should balance the points over all learners. This happens because the loss improvements are
inffor all points.A temporary solution would be to force all learners to have the same amount of points by using: