adaptive icon indicating copy to clipboard operation
adaptive copied to clipboard

run test_balancing_learner for all strategies

Open basnijholt opened this issue 6 years ago • 3 comments

@python-adaptive/core this reveals a regression in the LearnerND.

Should we merge this already (without a fix)?

also: @JornHoofwijk

basnijholt avatar Sep 18 '19 15:09 basnijholt

Something broke in between these two commits to learnerND.py image

However, when I reverse the exact changes from ca8b1d5f70ca7fc05a2c8fddf813894a19fc3595 in that state of the repo, it is still broken.

So seemingly it is not the code inside the LearnerND that causes the error.

basnijholt avatar Sep 18 '19 15:09 basnijholt

test.py

#!/usr/bin/env python3
import sys
from functools import partial
import adaptive

f = lambda x: x[0]
learner = adaptive.BalancingLearner(
    [adaptive.LearnerND(f, bounds=[(-1, 1), (-1, 1)])], strategy="loss"
)
try: # fails in master
    adaptive.runner.simple(learner, goal=lambda l: l.learners[0].npoints > 20)
except:
    sys.exit(1)
sys.exit(0)

using the power of git bisect:

export PYTHONWARNINGS="ignore"
git bisect start ca8b1d5f70ca7fc05a2c8fddf813894a19fc3595 3f617442acdff18fcf4c2aceb725f7a93f0827c9
git bisect run ./test.py
running ./test.py
Bisecting: 4 revisions left to test after this (roughly 2 steps)
[c233ceb9daecd7eaa32232551e2b3c5472ede815] change while loop to normal loop
running ./test.py
Bisecting: 2 revisions left to test after this (roughly 1 step)
[07f24b9ee02c72d811726c8dc76bd92ccd18b41e] add a test to ask for 0 points
running ./test.py
Bisecting: 0 revisions left to test after this (roughly 1 step)
[dc846e1513f7d28dcd5dd3fa9d1d7622a1b56222] add missing tell_pending
running ./test.py
Bisecting: 0 revisions left to test after this (roughly 0 steps)
[fa616ef3537ac954138f2bf7fbc20cb1159e5ea3] fix asking for 0 points
running ./test.py
dc846e1513f7d28dcd5dd3fa9d1d7622a1b56222 is the first bad commit
commit dc846e1513f7d28dcd5dd3fa9d1d7622a1b56222
Author: Bas Nijholt <[email protected]>
Date:   Sun Mar 17 17:10:55 2019 +0100

    add missing tell_pending

So dc846e1513f7d28dcd5dd3fa9d1d7622a1b56222 is the culprit introduced in https://github.com/python-adaptive/adaptive/pull/160.

basnijholt avatar Sep 18 '19 15:09 basnijholt

We should probably add the test, but we can probably wait until #220 is merged, because that will replace LearnerND anyway.

jbweston avatar Oct 17 '19 09:10 jbweston