Coder Social home page Coder Social logo

Comments (5)

basnijholt avatar basnijholt commented on June 30, 2024

originally posted by Joseph Weston (@jbweston) at 2018-07-13T11:16:03.002Z on GitLab

More details please

from adaptive.

basnijholt avatar basnijholt commented on June 30, 2024

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

from adaptive.

basnijholt avatar basnijholt commented on June 30, 2024

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'

from adaptive.

basnijholt avatar basnijholt commented on June 30, 2024

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.

from adaptive.

basnijholt avatar basnijholt commented on June 30, 2024

originally posted by Jorn Hoofwijk (@jorn) at 2018-09-25T11:47:55.034Z on GitLab

we could do it similarly as with the LearnerND: add a with restore(self) to allow not adding the data.

Also this would be solved if we would switch to a new BalancingLearner: !113

from adaptive.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.