-
Notifications
You must be signed in to change notification settings - Fork 19
random seeds are now perturbed with time. and can now give random str… #10
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
base: master
Are you sure you want to change the base?
Conversation
…of added so to consecutive threads that get seeded in consecutive seconds can not get the same seed by chance
Seed can not be bigger than a certain number. thus changed it.
|
By using |
|
yes, I do agree. On the other hand I think it is quite important that the seed is not the same (1...N) in every calibration run. How about seeding the main process, drawing k random numbers (k=number of workers in the pool), which then serve to seed the generators of all workers? in this way the system is deterministic but still depends on the main seed, which can be changed. also, I think it is very important to pass on the Random Stream to the postfn function, so that random numbers needed to compute the likelihood come from the same stream. otherwise they come from numpy.random, whose state random state (in Unix) is inherited from the main process, and thus the random numbers in the postfn function on different processes are identical. |
|
Ah, now I see the issue that the current reseeding causes. Creating the seeds in the main process is actually a good idea. I need to think about what happens when paralellizing with MPI but at the moment I think it could do the trick. I would like to keep the function signature of |
How about making random state an optional argument then? |
…g to get the initial samples
|
Do you see an other way to do this than wrapping the postfn-call in a try-except? This is not very elegant, in particular because in 99% of the applications it will fall in the except block |
|
I do not have experience with this, but the inspect module might be an option. You can get the number of arguments a function takes as well as the names of kwargs. |
|
Inspecting the callable before the call to identify the number of params feels a bit like overkill and not very pythonic |
|
right. maybe use a parameter that can be True or False when you setup the 2016-04-21 10:23 GMT+02:00 jakeret [email protected]:
|
…n the main process which creates seeds for the forked processes. also has a restart function. still using my implementation to be able to give the random state to postfn
|
I just implemented what I wrote in my last comment. Up to you if you like it and want to include it in your version. For my application it is necessary. |
|
Could you give me some information on your application so that I can understand why it's neccessary? |
|
Because I am using it to calibrate a stochastic model (that means I make extensive use of random numbers in the model) and I would like to be able to control the rng state of the model too, otherwise the calibration is not reproducible. |
|
Can't you use the theta values passed to your function to seed the |
|
You mean a seed depending on the parameter values? I don't get it. 2016-04-22 10:45 GMT+02:00 jakeret [email protected]:
|
|
Exactly, e.g. define the seed to be the sum or product over all the parameters. In principle the proposed parameters all come from a reproducible rng stream. It's not perfect but simple |
|
But then the seed is the same for a given parameter set. Not a good idea 2016-04-22 13:28 GMT+02:00 jakeret [email protected]:
|
corrected error (typo)
…eam to postfn