You might have come across the concept of seeding in order to make the ML pipeline reproducible in various scientific libraries like Numpy and PyTorch.
Behind the scenes, it interacts with an RNG (Random Number Generator), Pseudo-RNG in fact to generate the same random number given a seed.
To achieve this reproducibility (especially for Deep Learning projects) you can use the below function that seeds almost all the RNGs used in the projects.
But anyway, reproducibility is not the agenda of this article.
The interesting part is - the number 42
Usage of “42” is more of a choice rather than a chance here.
As per this tweet, 42 is the most widely used seed number across all the GitHub projects.
But why 42 you ask?
There are many theories around what would have led to this but my personal favorite is - Because it is the answer to:
For Douglas Adams fans - you must have guessed it.
It’s from his famous book - The Hitchhiker's Guide to the Galaxy where the supercomputer named “Deep Thought” gave 42 as the answer to the “Ultimate Question of Life, the Universe, and Everything”.
Here is the conversation with “Deep Thought”:
Yup. That’s it. 42 in “seed(42)” is a choice, a RANDOM choice in fact ;-).
It’s like the universe telling you:
Thanks for the read !!
If this post ended up in the Promotions tab, please move it to your Primary tab or Whitelist this email address, so that next time you don’t lose it.
Haha loved it❤️