How to use the adaptive.Learner2D function in adaptive

To help you get started, we’ve selected a few adaptive examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github python-adaptive / adaptive / benchmarks / benchmarks / benchmarks.py View on Github external
def setup(self):
        self.learner = adaptive.Learner2D(f_2d, bounds=[(-1, 1), (-1, 1)])
        self.xs = np.random.rand(50 ** 2, 2)
        self.ys = np.random.rand(50 ** 2)
github python-adaptive / adaptive / docs / logo.py View on Github external
def create_and_run_learner():
    def ring(xy):
        import numpy as np

        x, y = xy
        a = 0.2
        return x + np.exp(-((x ** 2 + y ** 2 - 0.75 ** 2) ** 2) / a ** 4)

    learner = adaptive.Learner2D(ring, bounds=[(-1, 1), (-1, 1)])
    adaptive.runner.simple(learner, goal=lambda l: l.loss() < 0.01)
    return learner