From 312b14441ebcae01a5b845dbdd59606040c4c812 Mon Sep 17 00:00:00 2001 From: Adrian Garcia Badaracco <1755071+adriangb@users.noreply.github.com> Date: Sat, 16 Jan 2021 01:49:35 -0600 Subject: [PATCH] MAINT: avoid modifying of RandomState object (#163) --- scikeras/wrappers.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scikeras/wrappers.py b/scikeras/wrappers.py index 2d0780ff3..1f082d190 100644 --- a/scikeras/wrappers.py +++ b/scikeras/wrappers.py @@ -762,8 +762,9 @@ def _initialize( # Given the same RandomState, the seed will always be # the same, thus giving reproducible results state = self.random_state.get_state() - self._random_state = self.random_state.randint(low=1) - self.random_state.set_state(state) + r = np.random.RandomState() + r.set_state(state) + self._random_state = r.randint(low=1) else: # int or None self._random_state = self.random_state