EpistasisLab / EpistasisLab/tpot2

Replace remaining calls to legacy `np.random.seed()`

Open
#112 1 comment 0 reactions 1 assignee Claimed by @perib View on GitHub
bug enhancement
Dominant language
Jupyter Notebook
Stars
250
Forks
33
PR merge metrics
No merged PRs in 30d

Description

Thanks for all of your work on TPOT! I and my colleagues use it very often for a variety of synthetic biology research projects.

I'd like to ask that TPOT 2 accept / use only [`np.random.Generator`](https://numpy.org/doc/stable/reference/random/generator.html) objects as an alternative to `int` RNG seeds, and avoid using the global / legacy `np.random` number generator, even internally, if possible. A quick search through the TPOT2 code at the time of writing (11/17/23), shows this is largely already the case except for 3 remaining instances of the string "random.seed", which refer to the legacy [`np.random.seed()`](https://numpy.org/doc/stable/reference/random/generated/numpy.random.seed.html).

Our code sometimes executes multiple `TPOTRegressors` in parallel, and TPOT 1's dependence on the global `np.random` generator has caused problems with repeatability. For example, if unpredictable OS-level thread scheduling changes the sequence of calls to the shared [`np.random.randint()`](https://numpy.org/doc/stable/reference/random/generated/numpy.random.randint.html) or similar functions. There are workarounds, e.g. using subprocesses instead of threads, but IMO TPOT should be maximally flexible and ideally not require workarounds.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.