out_of_range handling issues

11 views
Skip to first unread message

Bob Carpenter

unread,
Oct 23, 2015, 2:03:21 PM10/23/15
to stan...@googlegroups.com
[moved to dev]

This one may be relevant, so I bumped it and assigned
it to Daniel:

https://github.com/stan-dev/math/issues/88

I also created a new math issue:

https://github.com/stan-dev/math/issues/193

When that's sorted, we need to go back up and fix the Stan
manual and all the interfaces to make sure they handle the
different kind of exception properly.

- Bob



> On Oct 23, 2015, at 1:25 PM, Daniel Lee <bea...@alum.mit.edu> wrote:
>
> I thought there is an open issue, but couldn't find it easily.
>
>> On Oct 23, 2015, at 12:05 PM, Bob Carpenter <ca...@alias-i.com> wrote:
>>
>> I agree that should be the behavior. Daniel --- is there an
>> issue to add this behavior for indexing errors? I know we've
>> talked about it.
>>
>> What's going on now is that all of our error-checking
>> conditions throw the same type of domain error for illegal
>> inputs.
>
> We actually changed that behavior. We now throw different errors. I'm not sure it is the correct error for every use, but it should be close.
>
>>
>> What will happen in the future is that we'll separate causes
>> for errors, like index mismatches, which are not recoverable
>> in normal programs and things like hitting 0 bounds, which may
>> not be a problem in future iterations (the "divergences" in Michael's
>> and now Stan's terminology).
>>
>> Now consider this fiendish program
>>
>> parameters {
>> real<lower=0, upper=1> theta;
>> ...
>>
>> model {
>> if (theta < 0.5)
>> y[20] ~ normal(mu, sigma);
>> else
>> y[10] ~ normal(mu, sigma);
>>
>> Now if 20 is out of range and 10 is in range, and theta is
>> unconstrained, the program will fail for proposals of theta < 0.5
>> and succeed for proposals of theta > 0.5.
>>
>> So the change will slightly break backward behavior, but we
>> decided that's a good thing here because we haven't been able
>> to imagine a situation where the above was intentional. We don't
>> want ways to add back-door rejection because it breaks the derivatives
>> underlying all of our algorithms.
>
> Yes, it breaks backwards compatibility, but I think that's relying on behavior that wasn't quite in our spec.
>
>
> If anyone finds the issue, can you post it here or bump it up on the issue tracker?
>
>
> Daniel
>
>
>
>>
>> - Bob
>>
>>> On Oct 23, 2015, at 6:12 AM, Sebastian Weber <sdw....@gmail.com> wrote:
>>>
>>> Hi!
>>>
>>> I just misprogrammed by Stan program, but I was surprised to see that Stan treated an array dimension mismatch as something which could potentially be ignored:
>>>
>>> Rejecting initial value:
>>> Error evaluating the log probability at the initial value.
>>>
>>> Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
>>> Exception thrown at line 486:
>>> assign: Rows of x (3) and rows of y (4) must match in size
>>> If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
>>> but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
>>>
>>> This is RStan 2.7.0. Shouldn't Stan stop immediately?
>>>
>>> Sebastian
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+...@googlegroups.com.
>>> To post to this group, send email to stan-...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+...@googlegroups.com.
>> To post to this group, send email to stan-...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+...@googlegroups.com.
> To post to this group, send email to stan-...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

Daniel Lee

unread,
Oct 23, 2015, 2:35:06 PM10/23/15
to stan...@googlegroups.com
Thanks.
> You received this message because you are subscribed to the Google Groups "stan development mailing list" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to stan-dev+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages