random-seed

Reproducible results using Keras with TensorFlow backend

此生再无相见时 提交于 2019-11-27 06:03:51
问题 I am using Keras to build a deep learning LSTM model, using TensorFlow backend. Each time I run the model, the result is different. Is there a way to fix the seed to create reproducible results? Thank you! 回答1: As @Poete_Maudit said here: How to get reproducible results in keras To get reproducible results you will have to do the following at the very beginning of your script (that will be forced to use a single CPU ): # Seed value (can actually be different for each attribution step) seed

Should I use `random.seed` or `numpy.random.seed` to control random number generation in `scikit-learn`?

故事扮演 提交于 2019-11-27 01:07:40
I'm using scikit-learn and numpy and I want to set the global seed so that my work is reproducible. Should I use numpy.random.seed or random.seed ? Edit: From the link in the comments, I understand that they are different, and that the numpy version is not thread-safe. I want to know specifically which one to use to create IPython notebooks for data analysis. Some of the algorithms from scikit-learn involve generating random numbers, and I want to be sure that the notebook shows the same results on every run. Should I use np.random.seed or random.seed? That depends on whether in your code you

Is there an alternative to using time to seed a random number generation?

安稳与你 提交于 2019-11-26 22:43:45
I'm trying to run several instances of a piece of code (2000 instances or so) concurrently in a computing cluster. The way it works is that I submit the jobs and the cluster will run them as nodes open up every so often, with several jobs per node. This seems to produce the same values for a good number of the instances in their random number generation, which uses a time-seed. Is there a simple alternative I can use instead? Reproducibility and security are not important, quick generation of unique seeds is. What would be the simplest approach to this, and if possible a cross platform

Differences between numpy.random and random.random in Python

狂风中的少年 提交于 2019-11-26 19:27:30
I have a big script in Python. I inspired myself in other people's code so I ended up using the numpy.random module for some things (for example for creating an array of random numbers taken from a binomial distribution) and in other places I use the module random.random . Can someone please tell me the major differences between the two? Looking at the doc webpage for each of the two it seems to me that numpy.random just has more methods, but I am unclear about how the generation of the random numbers is different. The reason why I am asking is because I need to seed my main program for

Is set.seed consistent over different versions of R (and Ubuntu)?

淺唱寂寞╮ 提交于 2019-11-26 14:36:08
问题 I am currently running R version 3.1.0 (on Ubuntu 12.04 LTS) and as both my R version and my operating system is getting rather old, I plan on updating both. However, I have a lot of simulations that rely on set.seed() and I would like them to still give me the same random numbers after updating both R and my operating system. So my question is three-fold. Can I update R without changing which numbers are generated from each seed? Can I do the same for my operating system? If no to either 1)

Generating uniform random numbers in Lua

最后都变了- 提交于 2019-11-26 14:28:36
问题 I am working on programming a Markov chain in Lua, and one element of this requires me to uniformly generate random numbers. Here is a simplified example to illustrate my question: example = function(x) local r = math.random(1,10) print(r) return x[r] end exampleArray = {"a","b","c","d","e","f","g","h","i","j"} print(example(exampleArray)) My issue is that when I re-run this program multiple times (mash F5 ) the exact same random number is generated resulting in the example function selecting

Which seeds have to be set where to realize 100% reproducibility of training results in tensorflow?

a 夏天 提交于 2019-11-26 09:59:18
问题 In a general tensorflow setup like model = construct_model() with tf.Session() as sess: train_model(sess) Where construct_model() contains the model definition including random initialization of weights ( tf.truncated_normal ) and train_model(sess) executes the training of the model - Which seeds do I have to set where to ensure 100% reproducibility between repeated runs of the code snippet above? The documentation for tf.random.set_random_seed may be concise, but left me a bit confused. I

Reproducible results in Tensorflow with tf.set_random_seed

情到浓时终转凉″ 提交于 2019-11-26 09:51:52
问题 I am trying to generate N sets of independent random numbers. I have a simple code that shows the problem for 3 sets of 10 random numbers. I notice that even though I use the tf.set_random_seed to set the seed, the results of different runs do not look alike. Any help or comments are greatly appreciated. (py3p6) bash-3.2$ cat test.py import tensorflow as tf for i in range(3): tf.set_random_seed(1234) generate = tf.random_uniform((10,), 0, 10) with tf.Session() as sess: b = sess.run(generate)

Should I use `random.seed` or `numpy.random.seed` to control random number generation in `scikit-learn`?

若如初见. 提交于 2019-11-26 09:34:24
问题 I\'m using scikit-learn and numpy and I want to set the global seed so that my work is reproducible. Should I use numpy.random.seed or random.seed ? Edit: From the link in the comments, I understand that they are different, and that the numpy version is not thread-safe. I want to know specifically which one to use to create IPython notebooks for data analysis. Some of the algorithms from scikit-learn involve generating random numbers, and I want to be sure that the notebook shows the same

Differences between numpy.random and random.random in Python

江枫思渺然 提交于 2019-11-26 04:36:27
问题 I have a big script in Python. I inspired myself in other people\'s code so I ended up using the numpy.random module for some things (for example for creating an array of random numbers taken from a binomial distribution) and in other places I use the module random.random . Can someone please tell me the major differences between the two? Looking at the doc webpage for each of the two it seems to me that numpy.random just has more methods, but I am unclear about how the generation of the