Skip to content

Commit a7a1822

Browse files
committed
add test for BalancingLearner for point distribution over learners
1 parent a273049 commit a7a1822

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

adaptive/tests/test_balancing_learner.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,12 @@ def test_balancing_learner_loss_cache():
2121
bl = BalancingLearner([learner])
2222
assert bl.loss(real=False) == pending_loss
2323
assert bl.loss(real=True) == real_loss
24+
25+
26+
def test_distribute_first_points_over_learners():
27+
learners = [Learner1D(lambda x: x, bounds=(-1, 1)) for i in range(10)]
28+
learner = BalancingLearner(learners)
29+
points, _ = learner.ask(100)
30+
i_learner, xs = zip(*points)
31+
# assert that are all learners in the suggested points
32+
assert len(set(i_learner)) == len(learners)

0 commit comments

Comments
 (0)