-
-
Notifications
You must be signed in to change notification settings - Fork 372
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
Exception in transformed parameters stops sampling #2562
Comments
Stan v2.17.0 is correct (through CmdStan). This is what it looks like:
Stan v2.17.1 (and using develop) is not correct:
So... we've got to hunt down what's caused this and fix it. |
Does anyone know if the exception type changed in |
I don't think anything in write_array has changed recently.
Lots of pending changes with Mitzi's refactor, but even that shouldn't change exception types.
|
I verified that there was no change to exception types. But I did see a lot of changes to |
@mitzimorris, I found an error in the generated code. Inside
The problem is that it's throwing within the section that's commented To line up with the existing behavior, it should be within the
|
There's an alternate fix. If we think the model shouldn't be instantiated when it violates the transformed parameters block, we need to do something a little more complicated. I think that makes sense. @bob-carpenter, think that's right? The log probability function should throw an exception if the constrained values used result in transformed parameters (or even generated quantities) that violate constraints EVEN IF the arguments to the functions that say to include it is set to false? |
The alternate way to fix this is to change |
used git blame to look at code for is this relevant? |
No, I tracked it down to a change in the generated code. If you look at it in v2.17.0 vs v2.17.1 you'll see that there's an
much higher in the code in v2.17.0 and it's missing in v2.17.1; right before validating the transformed parameters. So, the behavior of Stan programs have changed slightly now. Before, if you could evaluate the log probability and |
Shoudln't that be an |
Also, I think the right behavior should be that transformed parameter constraint violations should throw exceptions no matter whether they're being included in the output or not. |
Yes! Working off memory and I flipped the if.
…On Wed, Jun 27, 2018 at 3:29 PM Bob Carpenter ***@***.***> wrote:
Shoudln't that be an if (!include_tparams__)? Why return if including
them?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#2562 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAZ_FzEnQXXw3gsd2-4yAvVbZJKIaPn5ks5uA90IgaJpZM4U5quh>
.
|
Got it. I'll put up a pull request later to fix this problem (with tests).
…On Wed, Jun 27, 2018 at 3:30 PM Bob Carpenter ***@***.***> wrote:
Also, I think the right behavior should be that transformed parameter
constraint violations should throw exceptions no matter whether they're
being included in the output or not.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#2562 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAZ_FxdHpGmiECYsyYVOFWEixVsGD-KPks5uA91QgaJpZM4U5quh>
.
|
change was introduced as part of standalone generated quantities - 1ca2236 question: if you don't include transformed parameters, then how can you run standalone gqs? |
The transformed parameters need to generated in order to generate the standalone generated quantities. But they don't need to be output. |
Is there a PR for this? Who is working on it? Not sure the best way to label this in the github UI, but @syclik has said this is a blocker for 2.18. |
I’m working on it. No pr yet. It’s a bit complicated due to the changed
behavior. And I got sidetracked with CmdStan not bringing stable, but I
think I know what to do to tackle it.
…On Fri, Jul 6 2018 at 9:14 AM, ***@***.***> wrote:
Is there a PR for this? Who is working on it? Not sure the best way to
label this in the github UI, but @syclik <https://github.com/syclik> has
said this is a blocker for 2.18.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2562 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAZ_Fx6tRaFy1t432rF_MtbxLdpKMteWks5uD2LCgaJpZM4U5quh>
.
|
@syclik - happy to help out on generator code logic. |
Thanks. I’ll need to evaluate whether it is something that we fix in the
generator. It might not. I looked at the updated generated code and I think
it might be appropriate and won’t need to be changed.
…On Fri, Jul 6 2018 at 11:10 AM, ***@***.***> wrote:
@syclik <https://github.com/syclik> - happy to help out on generator code
logic.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2562 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAZ_F4d6hmklwozXK_9-OOtXTJXh-W_Fks5uD33JgaJpZM4U5quh>
.
|
… exception behavior in new generated code.
… exception behavior in new generated code.
… exception behavior in new generated code.
Summary:
An exception in transformed parameters stops sampling from continuing. It should catch the exception and continue to the next iteration, if possible.
Description:
When constraints are violated, it seems like the exception terminates Stan. We should catch it and move to the next iteration. It's odd that it doesn't print the messages to the logger. Perhaps there's some buffering happening.
Reproducible Steps:
Here's a Stan program:
Current Output:
From CmdStan. Header information then:
Expected Output:
From CmdStan. I'd expect header information, then
and if we got lucky and
theta
was drawn in the 0.9 to 1.0 range, it'd proceed as expected.Additional Information:
I'm seeing slightly different behavior in CmdStan and RStan, so I don't know what's up. I think this is probably being handled improperly by Stan, though.
Current Version:
v2.17.1
Edits
5/27. Daniel. Added reproducible example.
The text was updated successfully, but these errors were encountered: