check_random_state

artpop.util.check_random_state(seed)[source]

Turn seed into a RandomState instance.

Parameters
seedNone, int, list of ints, or RandomState

If seed is None, return the RandomState singleton used by numpy.random. If seed is an int, return a new RandomState instance seeded with seed. If seed is already a RandomState, return it. Otherwise raise ValueError.

Returns
random_stateRandomState

RandomState object.

Notes

This routine is adapted from scikit-learn. See http://scikit-learn.org/stable/developers/utilities.html#validation-tools.