I've been trying to use bayesopt for a research problem and been getting mixed results. I decided to try it with a simple example to try and understand the algorithm better. Here's the code:
x = optimizableVariable('x', [0, 1], 'Type', 'real');
y = optimizableVariable('y', [0, 1], 'Type', 'real');
optimisation_variables = [x, y];
results = bayesopt(@negSumSquared, optimisation_variables, 'MaxObjectiveEvaluations', 100, ...
'IsObjectiveDeterministic', true, 'AcquisitionFunctionName', 'expected-improvement-plus');
function result = negSumSquared(X)
result = -(X.x^2 + X.y^2);
When I run this bayesopt generates the surface and produces the following output:
Best observed feasible point:
Best estimated feasible point (according to models):
What's confusing me quite a lot then is the estimated best point according to models. When I run the following snippet:
Z(i, j) = predict(results.ObjectiveFcnModel, [X(i), Y(j)]);
I can confirm that min(Z) = -2 when X = 1 and Y = 1 as I would expect. So where is bayesopt pulling its best estimated feasible point from if it is not from the objective function model, and why is it so off compared to the true solution and the fitted points?
Thanks a lot for the help,