--

Thank you for your question!

As I explained in this post, you can use any positive integer including zero as the random state in machine learning models. There is no specific rule to choose random_state = 42. However, many people often tend to use the number "42" as the random state because that number has become famous for specific reasons. Some of them are (from Wikipedia): 42 is 101010 (binary code) in base-2. | Light refracts through a water surface by 42 degrees to create a rainbow. | Light requires 10 to the power of 42 seconds to cross the diameter of a proton. | Cricket has 42 laws.

I hope you got the idea behind often using random_state = 42. If you have any other questions, do not hesitate to ask them.

Happy learning!

--

--

Rukshan Pramoditha
Rukshan Pramoditha

Written by Rukshan Pramoditha

3,000,000+ Views | BSc in Stats (University of Colombo, Sri Lanka) | Top 50 Data Science, AI/ML Technical Writer on Medium

Responses (1)