Objective function for fmincon from surrogate model

11 Ansichten (letzte 30 Tage)
Douglas Eddy
Douglas Eddy am 26 Jan. 2023
Kommentiert: Douglas Eddy am 27 Jan. 2023
Trying to automatically generate the fun objective function for fmincon from a second order quadratic model generated by fitlm. There is no easy way from the outputs of a fitlm model. It should be easy because there is quadratic function created at mdl.Formula.LinearPredictor. ModelCenter is able to able to optimize any function generated as a surrogate model by RSM, which is what fitlm does. Does anybody have some function code that can generate the fun function automatically for fmincon from a quadratic model?

Akzeptierte Antwort

Matt J
Matt J am 26 Jan. 2023
Bearbeitet: Matt J am 26 Jan. 2023
Can't you just do,
fun=@(X) norm(mdl.predict(X)-y).^2
  1 Kommentar
Douglas Eddy
Douglas Eddy am 27 Jan. 2023
Yes! This is exactly what I was looking for. I just was not able to find it in the search. Thanks!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Quadratic Programming and Cone Programming finden Sie in Help Center und File Exchange

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by