我正在尝试实现 sklearn 的 ParameterSampler ,但我不完全确定 random_state 参数的作用。
我的猜测是,如果 random_state 设置为 None,则使用正常的随机抽样。如果 random_state 不是 None,那么使用伪随机抽样?
我也不确定不同的 int 值如何影响采样。例如,random_state = 1 是 random_state = 2 的不同形式吗?如果是,如何?
请您参考如下方法:
来自documentation :
If
random_stateisNoneornp.random, then a randomly-initializedRandomStateobject is returned.If
random_stateis an integer, then it is used to seed a newRandomStateobject.If
random_stateis aRandomStateobject, then it is passed through.
基本上,通过设置 random_state,您保证(伪)随机数生成器每次生成相同的随机整数序列,这反过来又会影响您的数据方式采样。
