Skip to content

BalancingLearner puts all points in the first child-learner when asking for points with no data present #159

Description

@basnijholt
defh(x, offset=0):
a=0.01returnx+a**2/ (a**2+ (x-offset)**2)
learners= [adaptive.Learner1D(partial(h, offset=random.uniform(-1, 1)),
bounds=(-1, 1)) foriinrange(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')

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions