Random number seed in numpy

570 views Asked by At
numpy.random.seed(7)

In different machine learning and data analysis tutorials, I saw this seed set with a different number. Does it make a real difference in choosing a specific seed number? Or any number is fine? The goal of choosing a seed number is to reproducibility of the same experiments.

1

There are 1 answers

4
Carcigenicate On

Supplying the same seed will give the same results every time the program is run. This is useful during developing/testing to reliably get the same results over and over.

When your app is "in production", change the seed source to something dynamic, like the current time (or something less predictable) to have "typical random behavior". If you don't supply a seed, many generators will default to something like the current time as milliseconds since some epoch.

The actual number doesn't matter. I use my school ID number (9 digits), just out of habit since I have it thoroughly memorized, but also use short 2 digits numbers for quick tests if I want it to be reproducible.