Search code examples
reinforcement-learningopenai-gym

Why do we always need to set env.seed(#) for open gym ai?


I find out all of the reinforcement learning algorithms need to set the env.seed(#) in the first hand, I would like to know the reason behind it.

Thank you very much!


Solution

  • All the gym environments I've worked with have used numpy's random number generator. You certainly don't need to seed it yourself, as it will fall back to seeding on the current clock time. Seeds are specified manually whenever you're concerned about reproducibility. If you don't give your RNG the same seed, it will produce a different sequence of random numbers. Since machine learning is so empirically-driven, reproducibility is incredibly important.