Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
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