I found some np.random.seed() calls in a few regressors that are currently mutating the global NumPy state. This is generally bad practice for library code because it can cause sneaky side effects in a user's environment and makes it hard to get reproducible results when running things in parallel.
We should clean these up and switch to proper local random state management using check_random_state.
Impacted files:
skpro/regression/bootstrap.py: Line 113
skpro/regression/enbpi.py: Line 163
skpro/regression/ensemble/_bagging.py: Line 133
skpro/regression/mdn.py: Line 441
Proposed fix:
- Remove the
np.random.seed(...) calls.
- Use
sklearn.utils.check_random_state to handle the random_state parameter locally.
- For
mdn.py and _bagging.py, we'll need to add the check_random_state initialization to store a local RNG.
- Ensure any sampling or noise logic uses that local RNG instead of the global
np.random module.
bootstrap.py and enbpi.py already have a self._random_state object initialized, so there we just need to delete the global seed line.
I found some
np.random.seed()calls in a few regressors that are currently mutating the global NumPy state. This is generally bad practice for library code because it can cause sneaky side effects in a user's environment and makes it hard to get reproducible results when running things in parallel.We should clean these up and switch to proper local random state management using
check_random_state.Impacted files:
skpro/regression/bootstrap.py: Line 113skpro/regression/enbpi.py: Line 163skpro/regression/ensemble/_bagging.py: Line 133skpro/regression/mdn.py: Line 441Proposed fix:
np.random.seed(...)calls.sklearn.utils.check_random_stateto handle therandom_stateparameter locally.mdn.pyand_bagging.py, we'll need to add thecheck_random_stateinitialization to store a local RNG.np.randommodule.bootstrap.pyandenbpi.pyalready have aself._random_stateobject initialized, so there we just need to delete the global seed line.