Skip to content

Commit

Permalink
pass integer random_state to estimator in imputer (scikit-learn#15611)
Browse files Browse the repository at this point in the history
  • Loading branch information
david-cortes committed Nov 20, 2019
1 parent 3e4ad05 commit 01b04c5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions sklearn/impute/_iterative.py
Expand Up @@ -558,8 +558,11 @@ def fit_transform(self, X, y=None):
else:
self._estimator = clone(self.estimator)

if hasattr(self._estimator, 'random_state'):
self._estimator.random_state = self.random_state_
if hasattr(self._estimator, "random_state"):
if self._estimator.random_state is None:
random_state = self.random_state_.randint(
np.iinfo(np.int32).max)
self._estimator.set_params(random_state = random_state)

self.imputation_sequence_ = []

Expand Down

0 comments on commit 01b04c5

Please sign in to comment.