I have a thought, but maybe it's not easy to realize. Firstly, use a group of X and corresponding Y to train a model with optimal parameters, e.g. fitcknn algorithm (to get the optimal hyperparameters), then, use the model as objective function, and use bayesopt() to select the next 20 X values from the X ranges, and the correspoing Y values, and use the 20 group of [X, Y] as experimental data to train the algorithm again, repeat this process agin and again, finally, get the optimal results, I will do it, if anyone can give me suggestions, I would thanks very much, since I am not familar with algorithm, and which algorithm to choose should have quite influence on the final results~
Note, the [X, Y] are totally experimental results, so there isn't obvious relationship between them~
A simple case, but it seems the bayesopt() function can't use the trained model Md1, why? what's the problem~
rng default
X = unifrnd(0,10,30,3);
Y = unifrnd(0,2000,30,1);
Mdl = fitcknn(X,Y,'OptimizeHyperparameters','auto',...
'HyperparameterOptimizationOptions',...
struct('AcquisitionFunctionName','expected-improvement-plus'));
sat1 = optimizableVariable('s1',[0,10],'Type','real');
sat2 = optimizableVariable('s2',[0,10],'Type','real');
sat3 = optimizableVariable('s3',[0,10],'Type','real');
var=[sat1,sat2 sat3];
Fun = @(z)predict(Mdl,[z.s1,z.s2,z.s3]);
bayesObject = bayesopt(Fun,var,...
'MaxObjectiveEvaluations',20, ...
'Verbose',1);