Hi!
I would like to know if it is possible to get the point and the value where the global minimum of response surface can be found for each iteration step within your Ax framework in this time? Because what I need to do is to optimize and monitor the minimum value and its position for the target function in my work. Thank you so much for your help!
Hi @cx1234paris !
Good question. You cannot do this using the Loop API but you can do it using the Service API.
See this section here, in particular: https://ax.dev/tutorials/gpei_hartmann_service.html#4.-Run-optimization-loop
After each iteration, you can call best_parameters, values = ax_client.get_best_parameters() to get the point and value that you need.
Let me know if this helps!
Thank you for your explanation. However, in this case, if it is possible to define a customized botorch GP model as surrogate model within service API which is similar to the case in loop API? (https://botorch.org/tutorials/custom_botorch_model_in_ax)
Oh I see, that tutorial is actually using the Developer API! You can use this function: https://github.com/facebook/Ax/blob/fc4cd2ae821dbd2949956810a4ecb1073d598ffb/ax/service/utils/best_point.py#L97
Call that at any time to get the best point and value.
Thank you so much for your help! It works well as I expected! By the way , I still would like to know if it is possible to get a surface plot for the post-processing?
Hi @cx1234paris !
Couple things
get_best_parameters function, since we store the expected best point at the time of creation of every generator run, on that generator run, see here: https://github.com/facebook/Ax/blob/1ecee1b3481c82719c9a47756ba17832b121a251/ax/core/generator_run.py#L84get_optimization_trace plot in this tutorial: https://ax.dev/tutorials/gpei_hartmann_service.html#7.-Save-/-reload-optimization-to-JSON-/-SQL. While this is for the Service API, if you look at the internals of the function, you should be able to recreate it rather easily on your own.I'll let @lena-kashtelyan take it from here if you have further questions!
Thank you so much! I will see which is more adaptive for my project. Besides, what I want is to extract a 3D surface plot with X1, X2 and function value for a 2D function (ex. Branin). As for me I didn't find how to obtain it in your tutorial and API. If you have any indications for me in this point it will be really better but if not, it is not really important for my work. Thank you!
Oh I see! @cx1234paris is this what you're looking for?
https://ax.dev/tutorials/visualizations.html#2.-Contour-plots
It appears that this issue might be resolved with @ldworkin's response –– I'll also follow up by saying that in Service API, one can also obtain those contour plots (as shown in this section) of the tutorial. You can see those plots at any time during the experiment, provided the Bayesian optimization phase started (so after the first few trials).
@cx1234paris, feel free to reopen the issue if you need more help!