I am trying to implement sklearn's ParameterSampler, but I'm not completely sure what the random_state
parameter does.
My guess is that if random_state
is set to None
, then normal random sampling is used. And if random_state
is something other than None
, then pseudo random sampling is used?
Also I'm not sure how different int values affect the sampling. For example, is random_state = 1
different form random_state = 2
? If yes, how?
From the documentation:
If
random_state
isNone
ornp.random
, then a randomly-initializedRandomState
object is returned.If
random_state
is an integer, then it is used to seed a newRandomState
object.If
random_state
is aRandomState
object, then it is passed through.
Basically, by setting the random_state
, you guarantee that the (pseudo-) random number generator generates the same sequence of random integers each time, which in turn has an effect on the way your data is sampled.