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
Added seed for random numbers generators #62
Conversation
Added parameter to set the seed for the random numbers generator inside KDEUnivariate.sample.
Added parameter to set the seed for the random numbers generator inside GaussianUnivariate.sample.
Added parameter to set the seed for the random numbers generator inside Bivariate.sample.
Added parameter to set the seed for the random numbers generator inside GaussianMultivariate.sample.
Added seed management to Vine
simplified seed management
Simplified seed management
Simplified seed management
Simplified seed management
* Fixed variable names.
I can't understand what is failing in Travis. All those errors seem related to docstrings and rst files I didn't touch. |
Thanks for you contribution @echo66 ! Indeed, being able to pin the random seed within the sampling methods itself seems to be an interesting addition, so we really appreciate your interest in contributing these changes. Unfortunately, I'm afraid that your PR does not adhere to our contributing guidelines, which you can find here Briefly, I suggest the following approach:
|
Regarding the Travis build failure, it seems to be because some of the changed files do not pass the You check this locally by running |
Thanks for the feedback! I will do as you told. EDIT: I opened #63 |
Right now, when using the sampling methods, in order to get the same result everytime, we need to do the following things:
np.random.seed(seed_value)
random.set_state(random_state_tuple)
outside of the function being called (i.e.
sample
). This is what people call a "leaky abstraction", in software engineering. An easy way to cope with this is to include the seed as a parameter in thesample
method. Usually, we just take that seed, use it as an input for something likesklearn.check_random_state
and we receive a random numbers generator as an output, using it instead ofnumpy.random
. But since the code for some classes is using functions that allow us to pass the seed or random numbers generator instantiated by us, we need to be a little bit more sophisticated by usingnumpy.random.get_state
,numpy.random.set_state
,random.getstate
andrandom.setstate
.