Skip to content
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

Learner1D reports finite loss before bounds are done #316

Open
basnijholt opened this issue Apr 6, 2021 · 3 comments
Open

Learner1D reports finite loss before bounds are done #316

basnijholt opened this issue Apr 6, 2021 · 3 comments

Comments

@basnijholt
Copy link
Member

data = {
    0.19130434782608696: 2428.6145000000006,
    0.1826086956521739: 2410.7965000000004,
    0.2: 2449.1395,
}

learner = adaptive.Learner1D(
    None,
    bounds=(0, 0.2),
    loss_per_interval=adaptive.learner.learner1D.triangle_loss,
)
for x, y in data.items():
    learner.tell(x, y)

learner.loss()

prints 0.0015347736506519973.

A typical runner goal runner = adaptive.Runner(learner, goal=lambda l: l.loss() < 0.01) would finish after two points.

I think we should report an infinite loss until the boundary points are included.

@akhmerov, @jbweston, what do you think?

@jbweston
Copy link
Contributor

jbweston commented Apr 6, 2021

I definitely agree that the loss should be larger for the case you showed.

Would you agree that the reason why a loss of 1e-3 seems "wrong" is that the points are not well-distributed on the interval [0, 0.2]? If so, perhaps we could include an extra factor into the loss to penalize this.

As you point out, reporting an infinite loss until the boundary points are included could be the pragmatic choice, at least for the case where people are just using a Runner.

My only concern would be the case that someone starts from a bunch of data that does not necessarily include the boundaries.
It would be a little strange if your eyes are telling you that you already have a pretty good sampling, but adaptive is reporting a loss of infinity.

@jbweston
Copy link
Contributor

jbweston commented Apr 6, 2021

someone starts from a bunch of data that does not necessarily include the boundaries

IIRC in this case the learner will typically return the boundaries the next time you ask, so maybe this is not too egregious.

@akhmerov
Copy link
Contributor

akhmerov commented Apr 7, 2021

I agree with Joe's concern about the counter-intuitive loss behavior. We could instead add to the loss something like interval_size / (x_max - x_min) - 1.

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

No branches or pull requests

3 participants