-
-
Notifications
You must be signed in to change notification settings - Fork 186
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
propto doesn't work when there are no autodiff types #1020
Comments
What you said is correct. This is a design decision. Something else you'll find is the first term in both What do you think we should do? It's described pretty thoroughly in the Stan Math arxiv paper. https://arxiv.org/abs/1509.07164. Should we add it somewhere on the wiki and close this issue? |
Hmm, let's just close this issue and I'll add a note to the Discourse thread. It'll get search engine indexed and so hopefully comes up if anyone searches for propto and Stan. It's just something we gotta be aware of. |
It's tricky because we actually use the types to inform us what's a
constant in the math. I thought the arxiv paper on autodiff described it in
depth. If not, I've talked about it at NIPS 2014 and could dig up my
presentation there.
…On Wed, Sep 5, 2018 at 9:17 AM Ben Bales ***@***.***> wrote:
Hmm, let's just close this issue and I'll add a note to the Discourse
thread. It'll get search engine indexed and so hopefully comes up if anyone
searches for propto and Stan. It's just something we gotta be aware of.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1020 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAZ_F3qKsKSxdUhnGiMl0t8eL35ZT0Ulks5uX87SgaJpZM4WZV_i>
.
|
Yeah, just an easy confusion. I think what's here'll be fine. Not an issue that'll come up every day I don't suppose. |
Description
This issue follows up a problem @yao-yl found and posted here: https://discourse.mc-stan.org/t/dropping-the-constant-in-log-prob/3889/6
This function returns the log density of a normal:
This function returns the log density of a normal up to a proportionality constant:
The difference between the two should remain constant as a function of parameters (otherwise the proportionality constant isn't constant). If mu1 is a double, the difference between the two changes as mu1 takes different values (this is presumeably incorrect behavior).
If mu1 is a var (and presumeably any other autodiff type), it works correctly.
This is because the question of 'proportional to what' is baked in with are the variables autodiff types or not.
I'm pretty sure this is by design. Maybe we can have a wontfix label for this one? I assume it should be documented somewhere, but where might that be? I think it basically comes down to propto only works for autodiff types and should otherwise be set to false.
Example
Add this code to test/unit/math/rev/scal/prob/normal_log_test.cpp
And run ./runTests.py test/unit/math/rev/scal/prob/normal_log_test.cpp
Expected Output
It should output no errors. Instead the output is:
Which indicates that the proportionality constant is not constant between parameter values.
Current Math Version
v2.18.0
The text was updated successfully, but these errors were encountered: