UseParallel for hessian?

4 views (last 30 days)
Jonne Guyt
Jonne Guyt on 29 Jun 2018
Commented: Jonne Guyt on 4 Oct 2022
Will Matlab at some point support parallel computation of the finite difference Hessian? More specifically, I've been using UseParallel in my fminunc settings (which have a lot of parameters), but computing the Hessian takes a fair amount of time.
  4 Comments
Jonne Guyt
Jonne Guyt on 4 Oct 2022
I've stopped using Matlab but simply monitoring the system usage (# of cores) as well as the slowness were giveaways that it's not calculating in parallel

Sign in to comment.

Answers (1)

Matt J
Matt J on 2 Oct 2022
Edited: Matt J on 2 Oct 2022
I don't speak for MathWorks, but I think the issue is that finite difference Hessians are only relevant to the trust-region algorithm, since the quasi-newton algorithm does not use Hessian computations. But in the trust-region algorithm, the user is required to provide an analytical gradient computation via SpecifyObjectiveGradient=true. It seems a rather narrow use case that an analytical gradient calculation would be tractable, but not an analytical Hessian computation, assuming the memory footprint of such a matrix is not prohibitive. If the memory footprint of the Hessian is prohibitive, the user is meant to be use the HessianMultiplyFcn or HessPattern options.
  10 Comments
Jonne Guyt
Jonne Guyt on 4 Oct 2022
If you need the Hessian for the purposes of computing standard errors (and not iterative optimization), then I agree it may make sense to have a parallelized finite differencer for that. However, it is not clear why that belongs in fminunc/fmincon. Because the Hessian is not being recomputed iteratively, you would use a standalone Hessian computing routine for that.
Yes - this is exactly the use case. I think you inferred it was optimization, but I never mentioned this. If you request the hessian to be returned at the end (to compute SE's), it is approximated with finite differences, so it is 'built-in', but it might as well be standalone (hence my workaround). I hope it makes more sense now...
@Bruno Luong exact and approximated SE's may differ a small amount, but can you show me to where I can find that these are not suitable for discrete choice models with non-obvious gradients?

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by