Skip to content

Returning np.nan breaks the 1D learner #145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tlaeven opened this issue Jan 18, 2019 · 1 comment
Closed

Returning np.nan breaks the 1D learner #145

tlaeven opened this issue Jan 18, 2019 · 1 comment

Comments

@tlaeven
Copy link

tlaeven commented Jan 18, 2019

From commit: 4381a9e onward,
returning (a np.array of) np.nan cancels the runner.
Example code, to compare the working commit, f38d20f,
with the not working one, 4381a9e.

import adaptive
adaptive.notebook_extension()
import numpy as np
def f(x):
    if 0 < x < 1:
        return x
    else:
        return np.nan

learner = adaptive.Learner1D(f, 0.1*np.array([-1, 1]))
runner = adaptive.Runner(learner)
runner.live_info()
@basnijholt
Copy link
Member

Thanks for reporting this!

This is definitely a bug, previously we have decided that when a NaN is returned that it is ignored and that the learner should use the interpolated value, it should definitely not crash the runner!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants