You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In learner.train and learner.cross_validate, the global numpy random seed is set. This seems unnecessary since the randomized algorithms in scikit-learn generally take random seed arguments. Can we remove these?
Thanks for making this issue; this is something I meant to do a long time ago. We should switch to using random state objects like the scikit-learn documentation recommends. (I would provide links, but their site is actually down at the moment.)
If your code relies on a random number generator, it should never use functions like numpy.random.random or numpy.random.normal. This approach can lead to repeatability issues in unit tests. Instead, a numpy.random.RandomState object should be used, which is built from a random_state argument passed to the class or function. The function check_random_state, below, can then be used to create a random number generator object.
check_random_state: create a np.random.RandomState object from a parameter random_state.
If random_state is None or np.random, then a randomly-initialized RandomState object is returned.
If random_state is an integer, then it is used to seed a new RandomState object.
If random_state is a RandomState object, then it is passed through.
For example:
In
learner.train
andlearner.cross_validate
, the global numpy random seed is set. This seems unnecessary since the randomized algorithms in scikit-learn generally take random seed arguments. Can we remove these?skll/skll/learner.py
Line 907 in 5c113bc
skll/skll/learner.py
Line 1393 in 5c113bc
The text was updated successfully, but these errors were encountered: