Bug in bayesopt() function? Initial evaluation points table being incorrectly evaluated?
Ältere Kommentare anzeigen
Hi, I'm using the bayesopt() function in the Global Optimization Toolbox for a problem with integer variables. I'm providing my own initial points in the solution space for the algorithm to start from. I'm doing this in the way described in the documentation, i.e:
x1=optimizableVariable('x1',[0 3],'Type', 'integer');
x2=optimizableVariable('x2',[0 3],'Type', 'integer');
InitialX= table([int8(0),int8(1)],[int8(0),int8(1)]);
result = bayesopt(fun,[x1,x2],.....'InitialX',InitialX);
As you can see I have stated x1 and x2 to be optimizableVariables of type 'integer'. I have been careful to cast my values in InitialX as integers also. However when I run my code I get the following error message:
"Error using bayesoptim.BayesoptOptions/checkInitialX (line 413) Column 1 of InitialX is declared to be integer in the VariableDescriptions argument but contains some non-integer data."
When I investigated the code in bayesoptim.BayesoptOptions/checkInitialX I found that the error is being thrown because the function bayesoptim.isInteger() is evaluating the first column of my IntialX table to contain non-integers. When I checked this against the isinteger() function (in the same workspace) it found the same argument to be only integers. The screenshot shows this more clearly.

I'm surprised by this. I cant get a look at whats going on int bayesoptim.isInteger() so can't explain why it is evaluating differently to isinteger(), but surely this is wrong? Can anyone help me with fixing my problem so that I can use my InitialX table? Thanks
Akzeptierte Antwort
Weitere Antworten (1)
Alan Weiss
am 28 Sep. 2017
Your InitialX is a 1-by-2 table with contents
x1 = [0 1]
x2 = [0 1]
This is not what bayesopt expects. According to the documentation, InitialX should be an N-by-D table, where D = 2 in your case. Something like (for N = 2)
initable = table([0;1],[0;1],'VariableNames',{'x1','x2'});
Alan Weiss
MATLAB mathematical toolbox documentation
4 Kommentare
Bob Hickish
am 29 Sep. 2017
Alan Weiss
am 29 Sep. 2017
Oh, sorry, I thought that would work.
Well, the only other idea I have is to try some plain double-precision numbers instead of int8:
a0 = 0;
a1 = 1;
InitialX=table([a0;a1],[a0;a1],'VariableNames',{'x1','x2'});
If that works, I will ask the development staff whether there are restrictions that I didn't know about for passing points to bayesopt. If so, these restrictions should be documented.
Alan Weiss
MATLAB mathematical toolbox documentation
Bob Hickish
am 29 Sep. 2017
Bearbeitet: Bob Hickish
am 29 Sep. 2017
Don Mathis
am 29 Sep. 2017
This is a bug. We'll get you a workaround today. Sorry for the hassle.
Kategorien
Mehr zu Logical finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
