Using Hessian for least squares problem
4 views (last 30 days)
Show older comments
It looks like lsqnonlin() from MatLab can't make use of a Hessian (it is not stated explicitly by MatLab, but I read this in the article "Optimization and uncertainty analysis of ODE models using 2nd order adjoint sensitivity analysis" by P. Stapor and others). I want to use fminunc() that is able to make use of a Hessian. I produce the current curve derivatives for all involved points with MatLab Symbolic Toolbox, but I have to program objective function evaluation from the single point deriavtives. The article "Using Symbolic Mathematics with Optimization Toolbox™ Solvers" in MatLab documentation does not help because of programming involved in my case. Using a MatLab function for the objective function would require making the symbolic functions details to be available to this function. Then I need to make global all the symbolic functions involved which is not ideal. Does anyone know a better way to attack my problem?
3 Comments
John D'Errico
on 5 Jun 2021
Edited: John D'Errico
on 5 Jun 2021
Very often, I see people want to emulate what they found in a paper somewhere for no good reason. There are a lot of pieces of total crap published, with no other goal than to push up publication counts. And too often refs don't challenge what they see. Hey, it looks impressive. And I hear of publications that take papers with no need for refs at all, just run a quick spell check at best.
So, does lsqnonlin NOT do what you want? Is the data terrible and highly noisy, with outliers in it? A hessian won't help that much there. Better might be to use a robust approach, using an iteratively re-weighted scheme. And of course, GREAT starting values will be a must.
Another good approach might be to use a variable partitioning scheme, thus a partitioned nonlinear least squares. That can greatly improve the robustness of the solve, and reduce problems with poor starting values. It will also speed up the estimation, because it can significantly reduce the dimensionality of the search space.
Is there a numerical problem in the estimation? If so, then use of a Hessian with fminunc may make the problem even more ill-posed. Good starting values are HUGELY important on bad problems.
We don't see your model. We are not given your data nor the model. We don't even see a picture of your data. So knowing why you want to do this is impossible. What I do see is you seem very inexperienced with MATLAB, making comments about the need for global functions. You don't even need gloobal variables. And that means you are probably confused about how to solve this and even if you need to do what you are trying to do.
So if you really want help, then I would suggest providing your data. I would suggest clearly explaining the model. I would ask you to say why it is you feel lsqnonlin is inadequate for the purpose.
Accepted Answer
J. Alex Lee
on 6 Jun 2021
Now that the actual question is clarified as a coding question and not a math question, it seems these should help:
0 Comments
More Answers (0)
See Also
Categories
Find more on Calculus in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!