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

Use of random number generator seed #366

Open
DavidBrainard opened this issue Jun 26, 2018 · 1 comment
Open

Use of random number generator seed #366

DavidBrainard opened this issue Jun 26, 2018 · 1 comment

Comments

@DavidBrainard
Copy link
Contributor

DavidBrainard commented Jun 26, 2018

Closing previous issue because the topic has changed, and opening this one instead. Pasting in Nicolas' comments to get this started.

This is an issue warranting special attention, especially as new processing stages get cascaded and the user interacts with deep isetbio components via high levels scripts.
I think that the default behavior should a fixed seed (as Brian suggests), and that any ISETbio component that changes the rng state should save its current state before starting computation, and once finished it should restore that initial state (as David suggests). This should be done consistently with all components that modify the rng state, suggesting that maybe we need a centralized function that manages therng state and that all ISETbio components interact with Matlab's rng, via this function only.

Moreover, the proposed centralized function should get passed the rseed argument that the ISETbio component received, and only accept it if belongs to a set of valid arguments. This will enforce consistent usage of the rSeed argument across the entire stack.

@DavidBrainard
Copy link
Contributor Author

My view is that our goal here is to minimize the chance that someone gets surprised by what a function does. I think it will be surprising if functions monkey with the rng by default. That is, a user who sets the rng in some mode (frozen seed, 'shuffle', whatever) at the top level will expect that this setting will propagate through all the calculations. Routines that override however the rng was set will cause confusion, even more so if they don't set it back.

So I think that by default no routine should do anything to the rng seed. We tore our hair out over this sort of thing at one point with the Poisson rng and I think finally managed to get all of the resetting out.

I think it is OK for the default behavior to be overridable, as then the user has to do something active and shouldn't be surprised. This can still cause trouble, depending on how the rng seed is passed around. but I can see how one would like to be able to freeze the em trace while not freezing other stuff.

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

No branches or pull requests

1 participant