Skip to content

Conversation

@basnijholt
Copy link
Member

@basnijholt basnijholt commented Mar 8, 2019

Still very much a WIP:

import adaptive
import numpy as np
import random

offset = random.uniform(-0.5, 0.5)

def f(x, offset=offset):
    a = 0.01
    return x + a**2 / (a**2 + (x - offset)**2)

@adaptive.learner.learner1D.uses_nth_neighbors(0)
@adaptive.learner.learner1D.loss_returns(tuple, 2)
def uniform_loss(xs, ys):
    dx = xs[1] - xs[0]
    return dx, dx

learner = adaptive.Learner1D(f, bounds=(-1, 1), loss_per_interval=uniform_loss)

learner.loss()

adaptive.runner.simple(learner, lambda l: l.loss() < (0.01, 0.01))

@basnijholt basnijholt force-pushed the master branch 2 times, most recently from 91e38f1 to bc190a7 Compare July 29, 2019 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant