Re: GeoBUGS distributions

8 views
Skip to first unread message

Bob Carpenter

unread,
Dec 20, 2013, 7:03:20 PM12/20/13
to stan...@googlegroups.com
[back on stan-dev]

The context is structured matrices and having a special
case for zero in matrix multiplication to get rid of
the big expression trees in sparse matrices. More below.

On 12/20/13, 4:14 PM, Ben Goodrich wrote:
> On 12/20/2013 04:11 PM, Bob Carpenter wrote:
>> On 12/20/13, 4:05 PM, Ben Goodrich wrote:
>> ...
>>> Yeah, also what do people think of having the multiplication and
>>> division operations check to see if we are multiplying
>>> by exactly zero. It would slow things down a bit but might be offset
>>> by avoiding the autodiff.
>>
>> You mean multiplying by a double that's exactly zero? We could do
>> that, but I think it'll be a huge slowdown for the usual cases.
>
> That's what I meant. Maybe it should be a compile-option that is off by default, like -DDONTMULTIPLYBYZERO? You could
> even avoid multiplying by a zero var as long as the user knew to avoid initializing the parameters to zero.

That's an interesting idea. We just have to make sure
everything's testable and documentable for users. If
there are too many switches for them to set, it gets confusing.
And one is too many for most of us! But presumably doing something
just for this kind of modeling would be easier to manage.

I also think the ramifications are different once we start
computing Hessians --- there are going to be many more zeroes
if we do it the way we're doing now, which is computing an
N x N Hessian by running N passes where parameters are fvar<var>,
but all the tangents (derivative of fvar) are 0 but one. If
we move to vector-based derivatives, that's different again.

- Bob

Michael Betancourt

unread,
Dec 20, 2013, 8:12:36 PM12/20/13
to stan...@googlegroups.com
What about an "STAN Options" block? This would also allow us to specify first-order or higher-order
derivatives which would prevent huge and unnecessary compile times, as well as issues for compiling
distributions that don't have higher-order derivatives implemented.
Reply all
Reply to author
Forward
0 new messages