question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Manually adding points and changing the utility function

See original GitHub issue

I’m using the suggest-register paradigm and I’m doing two things that I think break something in the operation and I wanted to know how to do it correctly.

At some point, I want to suggest a parameter by myself, externally. So what I do is

my_pnt_from_an_oracle = 0
next_point = {'x': my_pnt_from_an_oracle} 
optimizer.register(params=next_point, target=f(my_pnt_from_an_oracle) )
_ = optimizer.suggest(utility) # I also call this, although I'm not sure it is necessary

After that, I also want to change the utility to exploitation rather than exploration because I happen to know that the point I’m manually adding, is supposed to be at least some local maxima and also that it is for sure higher than all the points that were suggested until now. So I change:

utility = UtilityFunction(kind="ei", kappa=0, xi=1e-4) #xi was 10 originally

But now whenever I run the suggest-register combo, I don’t seem to get any suggestions that are closer to my_pnt_from_an_oracle to try to find a better maximum. I think it may not be registered correctly? Although, it appears in optimizer.res.

Any suggestion on how to add a point and change the utility in the middle of an operation?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:17

github_iconTop GitHub Comments

1reaction
sguysccommented, Jul 29, 2022

Yes, another thing that helped me is:

optimizer.set_gp_params(n_restarts_optimizer=25)

You’re right about the length scale, it is weird that the length_scale matters, because after the fit if I look at optimizer._gp.kernel_ it has a different length_scale.

I think I’m withdrawing my question now that I get that the problem is the fact that I don’t get a good fit for a GP or if I do, it is overfitting the observations.

The reason is that anyway it’s going to have high uncertainty between the observations and essentially the problem is ill-posed so the suggestions are random or almost random. So it won’t go necessarily to the maximum value of the point I added, but according to the acquisition function.

And also, It is not just when adding points manually. It’s going to happen every time I can’t get a good fit. I’ll have to think about what I can do about it, but I don’t think there’s any problem with your package.

p.s. - thank you for your help and time!!

0reactions
bwheelz36commented, Jul 29, 2022

if you are having issues with over fitting, you can also set the alpha parameter in the call to set_gp_params. higher values will regularity more heavily and prevent over-fitting.

It’s good that you checked that the gaussian process model is actually fitting your data. I think we should maybe generate a plot or something like that to make it easier for people to realise when the fit has failed…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Utility Functions
New Utility Functions ... In the manual several functions are defined such TL(a) which computes the tangent line of a predefined function f(x)...
Read more >
CHAPTER 3
A utility function converts a consumption bundle into a number that can be used for the purpose of ranking. A person receives a...
Read more >
Economics 101
Suppose that you know the utility function for an individual is given by the equation U = XY where U is the total...
Read more >
Micro I. Lesson 4. Utility
If you are given a utility function U(x,y), it is easy to derive a given indifference curve from it: simply plot all points...
Read more >
Preferences and Utility - UCLA Economics
In Section 1 we analyse how the agent chooses among a number of competing alternatives, investigating when preferences can be represented by a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found