필터 지우기
필터 지우기

define objective function based on regression model

조회 수: 2 (최근 30일)
Khatere Dakhili
Khatere Dakhili 2022년 11월 28일
답변: Amal Raj 2023년 3월 23일
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

답변 (1개)

Amal Raj
Amal Raj 2023년 3월 23일
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.

카테고리

Help CenterFile Exchange에서 Econometrics Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by