stan-dev / stan

Stan development repository. The master branch contains the current release. The develop branch contains the latest stable development. See the Developer Process Wiki for details.
https://mc-stan.org
BSD 3-Clause "New" or "Revised" License
2.56k stars 366 forks source link

Allow drawing from the Laplace approximation and Pathfinder without evaluating log_p #3215

Closed avehtari closed 6 months ago

avehtari commented 12 months ago

Summary:

Currently, when drawing from the Laplace approximation, log_p and log_q are always evaluated for each draw. log_p and log_q are useful for diagnosing the accuracy of the Laplace approximation, but there are cases where we trust that the normal approximation at the mode is sufficient and then we would not need log_p and log_q, and evaluation of log_p for all draws usually takes much more time than finding the mode, computing hessian, and drawing from the normal take. So it would be useful to make it optional and output just 0 or NA to the csv when the user so requests.

The relevant part in Stan services is https://github.com/stan-dev/stan/blob/3c2b7bad93e37e787fd456e712996b19ef84de1f/src/stan/services/optimize/laplace_sample.hpp#L110

Naturally the change would need to make also in stan/arguments, cmdstan, and other interfaces, too

Current Version:

v2.32.2

bob-carpenter commented 11 months ago

I'm OK with providing this option. Some notes:

avehtari commented 11 months ago
SteveBronder commented 8 months ago

Also adding Pathfinder for this to not evaluate lp__ for the return samples for each pathfinder

avehtari commented 6 months ago

3249 fixed this for Pathfinder, but I guess Laplace part is not yet done