Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
avehtari opened this issue Aug 4, 2023 · 4 comments · Fixed by #3261
Closed
Labels

Comments

@avehtari
Copy link
Collaborator

avehtari commented Aug 4, 2023

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

// output draw, log_p, log_q

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

Current Version:

v2.32.2

@bob-carpenter
Copy link
Contributor

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

  • do we drop log_p and log_q both or provide independent options to drop either?
  • I would strongly prefer to drop columns in the output rather than including dummy values to prevent people from trying to use it
  • Our HMC sampler always provides log_p (and never provides log_q), so code that always assumes it exists will go astra
  • log_q takes about the same amount of time as drawing a sample given that we have Cholesky factored already (i.e., it's a high cost)

@avehtari
Copy link
Collaborator Author

avehtari commented Aug 8, 2023

  • For simplicity I would drop both
  • I suggested dummy values as I assumed there can be code assuming their existence, but I'm fine dropping the columns, too

@SteveBronder
Copy link
Collaborator

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

@SteveBronder SteveBronder changed the title Allow drawing from the Laplace approximation without evaluating log_p Allow drawing from the Laplace approximation and Pathfinder without evaluating log_p Nov 16, 2023
@avehtari
Copy link
Collaborator Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants