0

I am trying to make a prediction of a time series using RNN and the problem is that as I am trying to tune the ( number of epochs and nodes) it gives me different results when I run them again would appreciate your help I tried this but it doesn't work

import numpy as np
import tensorflow as tf
import random as python_random
np.random.seed(123)
python_random.seed(123)
tf.random.set_random_seed(1234)
  • Hi Mohammaad, welcome to SO. Can you try `tf.set_random_seed(1234)` instead of `tf.random.set_random_seed(1234)`? I refer to https://stackoverflow.com/a/51253945/5305519 – user5305519 Jun 18 '20 at 05:11

1 Answers1

0

You are doing everything right but your python is not doing his job. All you need to do is set the 'PYTHONHASHSEED' environment variable to any fixed value before running your program. 'PYTHONHASHSEED' is an environment variable, so you can use set command if you're using windows.

For more information you can have a look at Keras doc: https://keras.io/getting-started/faq/#how-can-i-obtain-reproducible-results-using-keras-during-development

Nazmul Hasan
  • 860
  • 6
  • 17