Forum

Technical Question ...
 
Notifications
Clear all

Technical Question on random.seed  

   RSS

0

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.

 

random.seed([1,2,100])

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
0

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 🙂 

0

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. 

@siowy

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.

Share:

Delete your account