Stochastic behaviour even after setting random.seed()
See original GitHub issuenumpy.random.multivariate_normal() result is not reproducible even if numpy.random.seed() is set.
np.random.seed(9) class1 = np.random.multivariate_normal(mean, cov, n_samples) class2 = np.random.multivariate_normal(mean, cov, n_samples)
class1 won’t be the same as class2. When I generate mean and cov with np.random.rand() it is reproducible. cov is a positive semi-definite matrix I generated using np.dot(A,A.T) where A is generated with random.rand()
This was on Python 2.7.12 with Numpy 1.11.1 on Ubuntu 16.04.1
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Seemingly nondeterministic behavior despite setting Random ...
Hi all, I'm working on an optimization problem on graphs using some code I ported from R to Julia. What's strange, is that...
Read more >On Model Stability as a Function of Random Seed
Stochastic Weight Averaging (NASWA) which improves the stability of models over random seeds. With our ASWA and NASWA based.
Read more >How to get stable results with TensorFlow, setting random seed
Deterministic behaviour can be obtained either by supplying a graph-level or an operation-level seed. Both worked for ...
Read more >UMAP Reproducibility — umap 0.5 documentation
UMAP is a stochastic algorithm – it makes use of randomness both to speed up ... can be reproduced exactly UMAP allows the...
Read more >Properly Setting the Random Seed in ML Experiments. Not as ...
Machine learning models make use of randomness in obvious and unexpected ways. At a conceptual level, this non-determinism may impact your ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
OK, I think I will close this (though feel free to keep discussing). If you think a note in the documentation would have helped you, please do have a look and open a pull request to improve it!
The data generated from each run of the code is same but from calling the function multiple times they are not. @MSeifert04 I now tried to re-set the seed and it helps a lot. Although not identical the data generated is much closer in class1 and class2. @seberg I am guessing these small changes are from the stochastic nature of the linalg part.
Thank you for the quick and helpful answers.