define objective function based on regression model

3 visualizaciones (últimos 30 días)
Khatere Dakhili
Khatere Dakhili el 28 de Nov. de 2022
Respondida: Amal Raj el 23 de Mzo. de 2023
Hello,
I'm trying to define an optimization problem. I have a model from Gaussian Process regression, and I have 3 inputs. I tried to define my objective function in two ways but none of them is working. The first one is:
p = optimvar("p","LowerBound",0,"UpperBound",1);
mio = optimvar("mio","LowerBound",-1,"UpperBound",1);
sigma = optimvar("sigma","LowerBound",0.01,"UpperBound",0.1);
% Set initial starting point for the solver
initialPoint.p = 0;
initialPoint.mio = 0;
initialPoint.sigma = 0.01;
% Create problem
problem = optimproblem;
problem.Objective = (GPR_model.predictFcn(array2table([p,mio,sigma],"VariableNames",{'p','mio','sigma'})) + 0.01804)^2;
The second one is with another function
function objective = objectiveFcn(p,mio,sigma)
temp = array2table([p,mio,sigma],"VariableNames",{'p','mio','sigma'});
yfit = GPR_hyperparameter_SV1.predictFcn(temp);
objective = (yfit + 0.01804)^2;
end
problem.Objective = fcn2optimexpr(@objectiveFcn,p,mio,sigma);
Does someone have a hint about how I should solve this problem?
Thank you very much in advance

Respuestas (1)

Amal Raj
Amal Raj el 23 de Mzo. de 2023
In both cases, you are adding a constant term of 0.01804 to the predicted value before squaring it. It is not clear why you are doing this, but if it is part of your optimization objective, then it is fine.
To solve the optimization problem, you can use any optimization solver that is compatible with MATLAB's optimization toolbox, such as fmincon or patternsearch. You can specify the lower and upper bounds for the three optimization variables, as you have already done, and use the initial point provided to start the optimization process.

Community Treasure Hunt

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

Start Hunting!

Translated by