Every time I run a Keras/TensorFlow code gives different results. Can someone suggest how to get reproducible numbers?
1 Answer
$\begingroup$
$\endgroup$
You'll have to set the random seed.
Theano mostly uses numpy for pRNG.
from numpy.random import seed
seed(1)
In Tensorflow, things are a bit more complicated
from numpy.random import seed
seed(1)
from tensorflow import set_random_seed
set_random_seed(2)
More information: https://machinelearningmastery.com/reproducible-results-neural-networks-keras/