def get_random_state(random_state):
# if it's a seed, return a new seeded RandomState
if isinstance(random_state, (int, np.int, long, np.long, NoneType)):
return RandomState(random_state)
# if it's a RandomState, it's been initialized
elif isinstance(random_state, RandomState):
return random_state
else:
raise TypeError('cannot seed new RandomState with type=%s'
% type(random_state))
评论列表
文章目录