Skip to content
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

Determine policy for controlling entropy #33

Open
fsaad opened this issue Dec 6, 2018 · 1 comment · May be fixed by #520
Open

Determine policy for controlling entropy #33

fsaad opened this issue Dec 6, 2018 · 1 comment · May be fixed by #520

Comments

@fsaad
Copy link
Collaborator

fsaad commented Dec 6, 2018

As it stands, Gen programs draw random bits from the global entropy store. Going forward some control over the random seed is required --- for debugging, reproduciblity, and independence of Gen code from other libraries.

The granularity of entropy control is a design choice. Some possibilities include:

  1. Continue using global seed which is set using Random.seed!(n)
    • pros: approach requiring least work
    • cons: unpredictable, no separation, harder to reproduce/debug results.
  2. Furnish each Gen method that makes random choices with an (optional) a formal parameter prng
    • pros: composes easily, reproducible, predictable, modular, adds minimal API complexity, each random procedure becomes deterministic given its inputs.
    • cons: needs implementation and design
  3. Design a special Monadic construct for the RandomSeed
    • pros: potentially more transparent to the user / designer of Gen library
    • cons: Julia does not have good native support for Monadic computation
  4. Design a single global entropy source for Gen only
    • pros: less complex than 2 and 3, separates Gen from other libraries.
    • cons: less modular, and should check if/how to implement such an object in Julia.
@bgroenks96
Copy link

Hi all,

I have been exploring the possibility of switching from Turing to Gen for some of my modeling tasks since it seems a lot more flexible.

Unfortunately, I have to say that I am quite shocked by this design choice to rely on the global RNG. It's standard practice in most Julia packages that involve random sampling and/or stochastic behavior for the RNG state to be included as a parameter (option 2 above). Is there any possibility on having this changed any time soon? I am not sure that I can use the package without this since it makes it much harder to maintain reproducibility when using other packages that also require access to some RNG state.

I am not sure if @fsaad is still working on this project, so maybe @ztangent or @alex-lew could weigh in?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants