-
-
Notifications
You must be signed in to change notification settings - Fork 191
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
Test speed advantage of using ulpdf instead of lpdf #1017
Comments
Test poisson and you should see a difference (and also dropping those ccdf calls should help) in speed. |
Correct me if I'm wrong, but doesn't |
As soon I hit comment I saw the part of the issue that mentioned the option to switch normalising on/off, never mind me |
Paul, I worked up an initial implementation on this branch. It's currently only for simple outcome likelihoods but let me know if the basic approach is consistent with how you would tackle it, or if you'd prefer a different method. As an example, calling:
Gives the model block:
Which compiles and samples under the |
Yes, this looks exactly like the approach I would have used! |
Nice! The problem is again this only works with stan2.25 and on. |
Yes, so we should only merge once rstan is at 2.25 as well or make the stan code generation conditional, which I personally want to avoid. |
Or just allow |
Great! Will work on updating and testing the rest of the likelihoods |
Quick clarification for the priors, am I right in assuming that if
Then
In other words it no longer needs the |
Correct.
Andrew Johnson <notifications@github.com> schrieb am Di., 10. Nov. 2020,
08:46:
… Quick clarification for the priors, am I right in assuming that if
normalise=TRUE gives:
target += student_t_lpdf(Intercept | 3, 1, 2.5);
target += student_t_lpdf(sigma | 3, 0, 2.5)
- 1 * student_t_lccdf(0 | 3, 0, 2.5);
Then normalise = FALSE gives:
target += student_t_lupdf(Intercept | 3, 1, 2.5);
target += student_t_lupdf(sigma | 3, 0, 2.5);
In other words it no longer needs the lccdf adjustments for parameters
with bounds, right?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1017 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADCW2AGSBIJIGEYGWRDJMU3SPDVWLANCNFSM4SSMAGPA>
.
|
Thanks! |
Paul - got this pretty close to a PR-ready state (on this branch). I've tested the models in the |
Amazing, thank you! Testing all from |
I realize we can close this isse since your PR has beem merged already. Thank you again for working in it! |
brms uses always
target +=
instead of~
. The tilde version uses log unnormalized pdf to avoid computation of constants that don't affect sampling. brms usestarget +=
with*_lpdf
that are log normalized pdfs to support marginal likelihood computations, but then computes the constants also when not needed. The new Stan release 2.25 has support for*_lupdf
that provide the log unnormalized pdf, so it would be possible to provide an option switch normalization off. It would be useful to make some speed tests with models that have expensive normalization terms and especially with for loops so that the normalization terms are computed many times. Unlikely of order of magnitude speed-ups but can be significant speed-ups for some models.The text was updated successfully, but these errors were encountered: