Technical Question ...
Clear all

Technical Question on random.seed  



In cluster analysis in python module on datacamp, in Impact of seeds on distinct clusters, the lecturer passed in a list of values into random.seed.



k-means is called once without a for loop in that example. Does it mean that k-means will automatically load these 3 seeds? I don't really understand how passing a list of value into random.seed works.




2 Answers

Can you screenshot the relevant part of the lesson and attach it here? It would make it a lot easier for others to help you 🙂 


Ok I've managed to track it down. The lesson is using numpy.random.seed, while there is also a random.seed from the Python standard library.

Based on my research, the best I can gather is that passing in a list is exactly the same as passing in an integer. It does nothing special, ie. it just makes the random numbers reproducible. 


o*g - sorry, I just saw your post. thanks a lot! Yea, from that lecture i was confused if somehow passing a list of int as seed will result in some sequence where seed is automatically updated when functions using pseudorandom generators are called. haha

Yea it's confusing for sure.


Delete your account