Objective function for fmincon from surrogate model

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?

 채택된 답변

Matt J
Matt J 2023년 1월 26일
편집: Matt J 2023년 1월 26일
Can't you just do,
fun=@(X) norm(mdl.predict(X)-y).^2

댓글 수: 1

Yes! This is exactly what I was looking for. I just was not able to find it in the search. Thanks!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Quadratic Programming and Cone Programming에 대해 자세히 알아보기

제품

릴리스

R2022a

질문:

2023년 1월 26일

댓글:

2023년 1월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by