2
$\begingroup$

Every time I run a Keras/TensorFlow code gives different results. Can someone suggest how to get reproducible numbers?

$\endgroup$

1 Answer 1

1
$\begingroup$

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/

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.