-
Notifications
You must be signed in to change notification settings - Fork 322
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
[QUESTION] Get the best predicted parameter (not observed) #1029
Comments
Hi @jultou-raa, thanks for posting here! Let me follow up with the team and get back to you. |
Hi @jultou-raa, would you be able to share the code you're using to run AxClient API? There is a way to do this, but the best way depends on your modeling setup. |
Hi @bernardbeckerman :) First of all, thank you for the quick reply ! For sure, I can explain the process followed for this example :)
For my example, looping four times gaves me:
Asking Is it this kind of information you needed? Thanks again for your help and all the Facebook/Ax team ! 👍 |
Hi guys ! Maybe something is not clear for you in my previous comment ? If so please feel free to ask me again :) Thanks for your help ! |
@jultou-raa one option that comes to mind is swapping out the acquisition function with See also ModularBoTorchModel, #278, and #615. Maybe one of the Ax devs knows of a better way. Also curious to know your use case for this. I've thought of doing something similar when it comes to fixed budget sizes, something to the effect of "every 10 iterations, try evaluating at the best-predicted location" to periodically demonstrate shorter-term gains to a stakeholder, especially for those less familiar with the efficiency of Bayesian optimization. Maybe a bad idea, but something that's come to mind. |
@sgbaird thanks for this response, and @jultou-raa sorry for the late reply! I agree with everything @sgbaird said, and also want to ask a bit more about your use case, particularly why you're looking for the modeled optimum rather than the optimum found so far. In the case that your goal is to do one final sample of the modeled optimum so as to get the best final result, I think this might not be the best strategy, since expected improvement is by definition the one-step optimal strategy for this purpose. Does that make sense? Also let me know if @sgbaird's solution works for you. |
Hi guys! Thank you @sgbaird for this answer. Tried both solution (Posterior mean and UCB) as you mentioned before. This is the way I use it: from ax.service.ax_client import AxClient
[...]
from ax.modelbridge.registry import Models
from botorch.acquisition import qUpperConfidenceBound, PosteriorMean
from ax.models.torch.botorch_modular.surrogate import Surrogate
from botorch.models.gp_regression import SingleTaskGP
ax_client = AxClient(generation_strategy=gs) # See post https://github.com/facebook/Ax/issues/1029#issuecomment-1192290881 for gs variable details
[...] # do the four first trials as mentioned above
gp_posterior_mean = Models.BOTORCH_MODULAR(
experiment=ax_client.experiment,
data=ax_client.experiment.fetch_data(),
surrogate=Surrogate(SingleTaskGP),
botorch_acqf_class=PosteriorMean, # Here I tried PosteriorMean or qUpperConfidenceBound
)
trial = gp_posterior_mean.gen(1)
trial.Arms[0].parameters Doing this i have two different results (using one or the other) for my exemple above:
Now I have three questions 😄:
@sgbaird and @bernardbeckerman, to answer you about why I need this. We do experiment that cost a lot, so the budget is small to reach the target. The idea behind is to finish an exploration/exploitation optimization (what GPEI or GPKG do) by a pure exploitation. for exemple if I got six shots to optimize my solution, it could be interesting for us to build the metamodel using 5 "smart" points and then the last one is a pure exploitation of the previous knowledge. In the exemple I gave you in this thread, the last point Expected Improvement asked me was 0.0020908159615589117. So, it is a little better than qUpperConfidenceBound but less than PosteriorMean... |
Hi @jultou-raa, Regarding your three questions:
Taking a step back, every acquisition function you consider here generates a candidate close to zero and I wouldn't read too much into the fact that 1.16e−3 is slightly closer to zero than 2.20e−3. Given the situation you describe, EI is probably a natural choice here as it aims to maximize the expected improvement given one more function evaluation. While it may feel like |
This seems answered and inactive, closing. Please feel free to reopen! |
Hi guys!
Playing with ax for a while, and I never found a "native" way to get a predicted optimal set of parameters.
For exemple : If I take a dummy function like$x^2+1$ and want to minimize it, I expect the optimal parameter to be $x=0$ .
Using the AxClient API, I'm trying to recover the best parameter using
ax_client.get_best_parameters()
. But this returns the best observed data from completed trials. So here I get the black left point near 0...Is-it possible to have something predicting the global optimum using the underlying model? Mean, a prediction of$x=0$ in my case?
If you want to play with this dataset, I give you a snapshot here
Thanks for your help!
The text was updated successfully, but these errors were encountered: