Closed basnijholt closed 5 years ago
originally posted by Jorn Hoofwijk (@Jorn) at 2018-07-13T11:30:09.676Z on GitLab
I told him to report this, however, here is an actual example:
import numpy as np
import adaptive
adaptive.notebook_extension()
def f(x):
return x
learner = adaptive.IntegratorLearner(f, (0,1), tol=1e-8)
runner = adaptive.Runner(learner, lambda l: l.done()) # runs perfect
runner.live_info()
learner1 = adaptive.IntegratorLearner(f, (0,1), tol=1e-8)
learner2 = adaptive.IntegratorLearner(f, (0,1), tol=1e-8)
balancer = adaptive.BalancingLearner([learner1, learner2])
runner = adaptive.Runner(balancer, lambda l: l.loss() < 0.1) # fails
runner = adaptive.Runner(balancer, lambda l: l.done()) # fails
runner = adaptive.Runner(balancer, lambda bl: all(l.done() for l in bl.learners)) # fails
runner.live_info()
especially the last one, i don't know why it fails yet
originally posted by Jorn Hoofwijk (@Jorn) at 2018-07-13T11:33:02.163Z on GitLab
got it:
Traceback (most recent call last):
File "test5.py", line 14, in <module>
runner = adaptive.BlockingRunner(balancer, lambda l: l.loss() < 0.1) # fails
File "/home/jorn/natk/bep/adaptive/adaptive/runner.py", line 152, in __init__
self._run()
File "/home/jorn/natk/bep/adaptive/adaptive/runner.py", line 175, in _run
points, _ = self.learner.ask(n_new_tasks)
File "/home/jorn/natk/bep/adaptive/adaptive/learner/balancing_learner.py", line 89, in ask
return self._ask_and_tell(n)
File "/home/jorn/natk/bep/adaptive/adaptive/learner/balancing_learner.py", line 73, in _ask_and_tell
n=1, add_data=False)
TypeError: ask() got an unexpected keyword argument 'add_data'
originally posted by Bas Nijholt (@basnijholt) at 2018-07-18T18:20:14.013Z on GitLab
Thanks for reporting, I've added some code to raise a NotImplementedError
when add_data=False
in the IntegratorLearner
here: https://gitlab.kwant-project.org/qt/adaptive/commit/8640b8d58006b634e278709fd185a6ed2d05bfcb.
This doesn't fix the issue but at least makes it clear as to why it happens.
(original issue on GitLab)
opened by tlaeven (@tlaeven) at 2018-07-12T15:41:39.141Z