random-seed

Determinism in tensorflow gradient updates?

Deadly 提交于 2019-11-29 07:10:12
So I have a very simple NN script written in Tensorflow, and I am having a hard time trying to trace down where some "randomness" is coming in from. I have recorded the Weights, Gradients, Logits of my network as I train, and for the first iteration, it is clear that everything starts off the same. I have a SEED value both for how data is read in, and a SEED value for initializing the weights of the net. Those I never change. My problem is that on say the second iteration of every re-run I do, I start to see the gradients diverge, (by a small amount, like say, 1e-6 or so). However over time,

How do I get the seed from a Random in Java?

只谈情不闲聊 提交于 2019-11-29 02:54:22
I am creating a deep clone for some object. The object contains a Random . Is it good practice to retrieve the seed from the Random ? If so, how? There isn't a Random.getSeed() . A Random is intended to be random. Usually you want two Random to produce different numbers rather than to produce the same numbers. You can copy a Random using serialisation/de-serialisation and get the "seed" field using reflection. (But I doubt you should be doing either) Unless the sequence is critical to you, you can take the view that the clone of a Random is itself or any new Random() What you can do is get the

Random seed Math.random in Java

北城以北 提交于 2019-11-28 13:44:57
In my code I use random numbers in different classes. How to define random seed? Can I define this seed for all the classes in the main code? double rnd = Math.random(); Thijser You will probably want to use the special Random class. It gives you more control over the random numbers. To do this you first need to create a new random object. Random generator = new Random(seed); Then generate a new number by double random = generator.nextDouble(); http://docs.oracle.com/javase/6/docs/api/java/util/Random.html 来源: https://stackoverflow.com/questions/17445813/random-seed-math-random-in-java

Is java.util.Random really that random? How can I generate 52! (factorial) possible sequences?

我是研究僧i 提交于 2019-11-28 13:25:49
问题 I've been using Random (java.util.Random) to shuffle a deck of 52 cards. There are 52! (8.0658175e+67) possibilities. Yet, I've found out that the seed for java.util.Random is a long , which is much smaller at 2^64 (1.8446744e+19). From here, I'm suspicious whether java.util.Random is really that random ; is it actually capable of generating all 52! possibilities? If not, how can I reliably generate a better random sequence that can produce all 52! possibilities? 回答1: Selecting a random

Reproducible results using Keras with TensorFlow backend

为君一笑 提交于 2019-11-28 11:18:26
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! 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_value= 0 # 1. Set `PYTHONHASHSEED` environment variable at a fixed value import os os.environ['PYTHONHASHSEED'

C++ need a good technique for seeding rand() that does not use time()

做~自己de王妃 提交于 2019-11-28 04:22:39
问题 I have a bash script that starts many client processes. These are AI game players that I'm using to test a game with many players, on the order of 400 connections. The problem I'm having is that the AI player uses srand( time(nullptr) ); But if all the players start at approximately the same time, they will frequently receive the same time() value, which will mean that they are all on the same rand() sequence. Part of the testing process is to ensure that if lots of clients try to connect at

Determinism in tensorflow gradient updates?

蓝咒 提交于 2019-11-27 18:38:34
问题 So I have a very simple NN script written in Tensorflow, and I am having a hard time trying to trace down where some "randomness" is coming in from. I have recorded the Weights, Gradients, Logits of my network as I train, and for the first iteration, it is clear that everything starts off the same. I have a SEED value both for how data is read in, and a SEED value for initializing the weights of the net. Those I never change. My problem is that on say the second iteration of every re-run I do

How do I get the seed from a Random in Java?

回眸只為那壹抹淺笑 提交于 2019-11-27 17:25:35
问题 I am creating a deep clone for some object. The object contains a Random . Is it good practice to retrieve the seed from the Random ? If so, how? There isn't a Random.getSeed() . 回答1: A Random is intended to be random. Usually you want two Random to produce different numbers rather than to produce the same numbers. You can copy a Random using serialisation/de-serialisation and get the "seed" field using reflection. (But I doubt you should be doing either) Unless the sequence is critical to

Generating uniform random numbers in Lua

馋奶兔 提交于 2019-11-27 09:05:19
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 the exact same array element. However, if I include many calls to the example function within the

Random seed Math.random in Java

随声附和 提交于 2019-11-27 07:51:26
问题 In my code I use random numbers in different classes. How to define random seed? Can I define this seed for all the classes in the main code? double rnd = Math.random(); 回答1: You will probably want to use the special Random class. It gives you more control over the random numbers. To do this you first need to create a new random object. Random generator = new Random(seed); Then generate a new number by double random = generator.nextDouble(); http://docs.oracle.com/javase/6/docs/api/java/util