jeudi 28 mai 2015

Global Seed for Multiple Numpy Imports

Assume that I have a Python project structure as:

main.py which imports random_initialization.py

main.py which imports sample_around_solution.py

Both random_initialization and sample_around_solution.py import numpy.

Now, random_initialization starts a random instance of a problem, main runs a algorithm and sample_around_solution uses random samples around the solution to compute some metric (quality of solution, say).

I want replicability of the runs for which I have numpy.random.seed(0) in both imported files. Is this the right way to do this? I feel there might be some edge case where this is a horrible idea.




Aucun commentaire:

Enregistrer un commentaire