random number generation tweaks in

29 views
Skip to first unread message

Bob Carpenter

unread,
Nov 18, 2013, 12:22:02 AM11/18/13
to stan...@googlegroups.com
Before I file an issue, I want to make sure I'm not
just missing the way to specify the chain ID.

We used that in Stan 1.3 in order to discard a number
of draws from the RNG. It's efficient in Boost using
the discard() method in RNGs like

http://www.boost.org/doc/libs/1_55_0/doc/html/boost/random/additive_combine_engine.html

The question is whether to make the Stan command line
specify the number to discard

./my-model ... random seed=123 discard=10000000000

or to make it something more like we have before, which
I'm not sure how to name. If we want to imply that we're
using it to run parallel RNGs from the same initial seed,
we could go with something like:

./my-model ... random seed=123 parallel=2

to do the same thing as our --chain=2 used to do.

With all this fancy argument apparatus, we could also think
about making discard only apply to some RNGs. Or we could
implement parallel differently for different RNGs.

RNGs have not been a problem for us before, so making
them configurable (beyond being able to discard) is not
at all a high priority.

Ben's been talking about replacing what we have with a newer
L'Ecuyer RNG, but I'd say if we do that, we just go with that
one and not make everything super-configurable for RNG.

- Bob

Michael Betancourt

unread,
Nov 18, 2013, 8:32:36 AM11/18/13
to stan...@googlegroups.com
The chain id should still advances the stride of the RNG so that chains with different chains ids
are valid given the same seed. If you think that is confusing I would recommend moving chain
to random -- parallel and discard are to abstract and we might want to change the way we
map chain id into a unique stride.
> --
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.

Bob Carpenter

unread,
Nov 18, 2013, 1:58:03 PM11/18/13
to stan...@googlegroups.com
What is the argument? I don't see it in the doc either
in the manual or using help-all. For instance,

./drug-disease-hier help-all | grep chain

returns nothing.

- Bob

Ben Goodrich

unread,
Nov 18, 2013, 2:45:11 PM11/18/13
to stan...@googlegroups.com
On Monday, November 18, 2013 12:22:02 AM UTC-5, Bob Carpenter wrote:
Ben's been talking about replacing what we have with a newer
L'Ecuyer RNG, but I'd say if we do that, we just go with that
one and not make everything super-configurable for RNG.

I don't know that user configuration is a huge priority, because the idea of parallel PRNG is so complicated that I wouldn't expect most users to know what to do (and those that do know what to do can change the source locally). That said, it seems like the Boost-compatible parallel PRNGs all have an abstract class that they inherit from, so if you figure out how to use one, you can basically use any of them.

I am pretty sure no one affirmatively recommends the PRNG Stan currently uses. It is like 25 years old. I think the most widely regarded library is

http://numbercrunch.de/trng/

but someone from DE Shaw argued for the inclusion of another one on the Boost mailing list

http://lists.boost.org/Archives/boost/2012/01/189293.php

Ben

Bob Carpenter

unread,
Nov 18, 2013, 3:02:06 PM11/18/13
to stan...@googlegroups.com


On 11/18/13, 2:45 PM, Ben Goodrich wrote:
> On Monday, November 18, 2013 12:22:02 AM UTC-5, Bob Carpenter wrote:
>
> Ben's been talking about replacing what we have with a newer
> L'Ecuyer RNG, but I'd say if we do that, we just go with that
> one and not make everything super-configurable for RNG.
>
>
> I don't know that user configuration is a huge priority, because the idea of parallel PRNG is so complicated that I
> wouldn't expect most users to know what to do (and those that do know what to do can change the source locally). That
> said, it seems like the Boost-compatible parallel PRNGs all have an abstract class that they inherit from, so if you
> figure out how to use one, you can basically use any of them.

From a user perpsective, it's simple. Take one seed,
and advance each parallel RNG by some large number
of samples so they don't overlap.

> I am pretty sure no one affirmatively recommends the PRNG Stan currently uses. It is like 25 years old.

The only reason we're using it is that it's the RNG in Boost that
lets you advance.

> I think the most
> widely regarded library is
>
> http://numbercrunch.de/trng/

That one looked good to me and it has a compatible license.

I just don't see it as a priority because we're not having
problems with RNG now. But if you want to add it, no problem.
It just needs to be wrapped in the basic Boost infrastructure
as you point out, which should be easy.

> but someone from DE Shaw argued for the inclusion of another one on the Boost mailing list
>
> http://lists.boost.org/Archives/boost/2012/01/189293.php

I'm a bit put off by the "my paper won best paper" argument,
given the best papers I've seen.

But hey, if they add something good to Boost then we could
use it.

- Bob


Michael Betancourt

unread,
Nov 18, 2013, 4:49:45 PM11/18/13
to stan...@googlegroups.com
I believe it's just "id". I can check tomorrow when I get my computer connected to the internet again.

Daniel Lee

unread,
Nov 18, 2013, 5:06:11 PM11/18/13
to stan...@googlegroups.com
Yes, it's "id."
 
Reply all
Reply to author
Forward
0 new messages