Using Bayesopt to optimize a basic function

What are some examples on using bayesopt, to optimize a basic function, such as x sin x. As i was having problems when trying to find out how to use the objective functions in bayesopt

Réponses (1)

Linan Huang
Linan Huang le 3 Jan 2022
Modifié(e) : Linan Huang le 3 Jan 2022
Here is an example of a simple 1D function that you can run BO directly to find the optimal.
The tricky part is to define the function handle that can deal with the BO variable, which is implicitly explained in the document.
var = optimizableVariable('theta',[1,10],'Type','real');
fun = @(x)objfunxx(x.theta); %Create Function Handles
results = bayesopt(fun,var)
function y = objfunxx(x)
y=x*sin(x);
end

Produits

Version

R2020a

Question posée :

le 15 Mai 2020

Modifié(e) :

le 3 Jan 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by