nimble icon indicating copy to clipboard operation
nimble copied to clipboard

enhance handling of optimization for Laplace

Open paciorek opened this issue 4 months ago • 1 comments

WIP: do not merge without discussion.

In particular @perrydv see my changes to custom_optim_inner.

Flagging @weizhangstats @paul-vdb @kenkellner in case anyone has thoughts on item 3 below or other thoughts on readiness to merge this into devel.

This makes a few enhancements to the "laplaceRpieces" work:

  1. Perry added capability for inner optimization to use inner Hessian to allow use of Newton's methods
  2. Wei fixed a small bug in buildOneAGHQuad
  3. Chris modified custom_optim_inner to return NaN rather than stopping if inner optimization fails. This allows outer optimization to proceed (e.g., in cases where BFGS tries an outer parameter value that causes inner gradients of NaN/Inf/huge values). He saw that for the CDFW carnivores example, such inner gradients occur (including when using TMB via unmarked), so we need robust handling of such inner optimization failures.

One open item. We have innerOptimWarning (default of FALSE) in our Laplace system to avoid overwhelming user with warnings about problems in the inner optimization. This needs to be extended into Chris' changes to custom_optim_inner presumably. Right now all warnings are being printed.

Also we'll presumably need to change the default inner optimization to nlminb per NCT issue discussion.

paciorek avatar Oct 17 '24 15:10 paciorek