From 2c7f5183dc9570cf07fd075b1ce102401b2d31b5 Mon Sep 17 00:00:00 2001 From: Ricardo Vieira Date: Thu, 5 Dec 2024 10:45:48 +0100 Subject: [PATCH 1/4] Bump numpy dependency --- conda-envs/environment-dev.yml | 2 +- conda-envs/environment-docs.yml | 2 +- conda-envs/environment-jax.yml | 2 +- conda-envs/environment-test.yml | 2 +- conda-envs/windows-environment-dev.yml | 2 +- conda-envs/windows-environment-test.yml | 2 +- requirements-dev.txt | 2 +- requirements.txt | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/conda-envs/environment-dev.yml b/conda-envs/environment-dev.yml index fcfe678215..71b6c78ed4 100644 --- a/conda-envs/environment-dev.yml +++ b/conda-envs/environment-dev.yml @@ -10,7 +10,7 @@ dependencies: - cachetools>=4.2.1 - cloudpickle - h5py>=2.7 -- numpy>=1.15.0 +- numpy>=1.25.0 - pandas>=0.24.0 - pip - pytensor>=2.26.2,<2.27 diff --git a/conda-envs/environment-docs.yml b/conda-envs/environment-docs.yml index b937978375..f795fca078 100644 --- a/conda-envs/environment-docs.yml +++ b/conda-envs/environment-docs.yml @@ -8,7 +8,7 @@ dependencies: - arviz>=0.13.0 - cachetools>=4.2.1 - cloudpickle -- numpy>=1.15.0 +- numpy>=1.25.0 - pandas>=0.24.0 - pip - pytensor>=2.26.2,<2.27 diff --git a/conda-envs/environment-jax.yml b/conda-envs/environment-jax.yml index 0c0b0f91fd..48649a617d 100644 --- a/conda-envs/environment-jax.yml +++ b/conda-envs/environment-jax.yml @@ -16,7 +16,7 @@ dependencies: - jaxlib>=0.4.28 - libblas=*=*mkl - mkl-service -- numpy>=1.15.0 +- numpy>=1.25.0 - numpyro>=0.8.0 - pandas>=0.24.0 - pip diff --git a/conda-envs/environment-test.yml b/conda-envs/environment-test.yml index 3d93385733..e6fe9857e0 100644 --- a/conda-envs/environment-test.yml +++ b/conda-envs/environment-test.yml @@ -11,7 +11,7 @@ dependencies: - cloudpickle - h5py>=2.7 - jax -- numpy>=1.15.0 +- numpy>=1.25.0 - pandas>=0.24.0 - pip - pytensor>=2.26.2,<2.27 diff --git a/conda-envs/windows-environment-dev.yml b/conda-envs/windows-environment-dev.yml index 309f7c4fb4..ee5bd206f4 100644 --- a/conda-envs/windows-environment-dev.yml +++ b/conda-envs/windows-environment-dev.yml @@ -10,7 +10,7 @@ dependencies: - cachetools>=4.2.1 - cloudpickle - h5py>=2.7 -- numpy>=1.15.0 +- numpy>=1.25.0 - pandas>=0.24.0 - pip - pytensor>=2.26.2,<2.27 diff --git a/conda-envs/windows-environment-test.yml b/conda-envs/windows-environment-test.yml index a3952c5dd9..fa59852830 100644 --- a/conda-envs/windows-environment-test.yml +++ b/conda-envs/windows-environment-test.yml @@ -13,7 +13,7 @@ dependencies: - libpython - mkl-service>=2.3.0 - m2w64-toolchain -- numpy>=1.15.0 +- numpy>=1.25.0 - pandas>=0.24.0 - pip - pytensor>=2.26.2,<2.27 diff --git a/requirements-dev.txt b/requirements-dev.txt index d98bf2ec1e..56f7f964fc 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -12,7 +12,7 @@ mcbackend>=0.4.0 mypy==1.5.1 myst-nb<=1.0.0 numdifftools>=0.9.40 -numpy>=1.15.0 +numpy>=1.25.0 numpydoc pandas>=0.24.0 polyagamma diff --git a/requirements.txt b/requirements.txt index 05dcb1cdb1..28c9456b5e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ arviz>=0.13.0 cachetools>=4.2.1 cloudpickle -numpy>=1.15.0 +numpy>=1.25.0 pandas>=0.24.0 pytensor>=2.26.1,<2.27 rich>=13.7.1 From efef5e9859e747398ea6366799181dd7b7e60cbe Mon Sep 17 00:00:00 2001 From: Ricardo Vieira Date: Thu, 5 Dec 2024 10:05:33 +0100 Subject: [PATCH 2/4] Add warning about changed behavior when passing Sequence for random_seed --- pymc/sampling/mcmc.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pymc/sampling/mcmc.py b/pymc/sampling/mcmc.py index 59b2977c33..034ebde6bf 100644 --- a/pymc/sampling/mcmc.py +++ b/pymc/sampling/mcmc.py @@ -528,10 +528,8 @@ def sample( random_seed : int, array-like of int, or Generator, optional Random seed(s) used by the sampling steps. Each step will create its own :py:class:`~numpy.random.Generator` object to make its random draws in a way that is - indepedent from all other steppers and all other chains. If a list, tuple or array of ints - is passed, each entry will be used to seed the creation of ``Generator`` objects. - A ``ValueError`` will be raised if the length does not match the number of chains. - A ``TypeError`` will be raised if a :py:class:`~numpy.random.RandomState` object is passed. + indepedent from all other steppers and all other chains. + A ``TypeError`` will be raised if a legacy :py:class:`~numpy.random.RandomState` object is passed. We no longer support ``RandomState`` objects because their seeding mechanism does not allow easy spawning of new independent random streams that are needed by the step methods. progressbar : bool, optional default=True @@ -730,6 +728,12 @@ def joined_blas_limiter(): if random_seed == -1: random_seed = None + elif isinstance(random_seed, tuple | list): + warnings.warn( + "A list or tuple of random_seed no longer specifies the specific random_seed of each chain. " + "Use a single seed instead.", + UserWarning, + ) rngs = get_random_generator(random_seed).spawn(chains) random_seed_list = [rng.integers(2**30) for rng in rngs] From 2fcea58257569476a0ee22eb5b57f4ad6a45c23f Mon Sep 17 00:00:00 2001 From: Ricardo Vieira Date: Thu, 5 Dec 2024 10:05:53 +0100 Subject: [PATCH 3/4] Deprecate `random_seed=-1` behavior --- pymc/sampling/mcmc.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pymc/sampling/mcmc.py b/pymc/sampling/mcmc.py index 034ebde6bf..bc3e3475d1 100644 --- a/pymc/sampling/mcmc.py +++ b/pymc/sampling/mcmc.py @@ -727,6 +727,10 @@ def joined_blas_limiter(): ) if random_seed == -1: + warnings.warn( + "Setting random_seed = -1 is deprecated. Pass `None` to not specify a seed.", + FutureWarning, + ) random_seed = None elif isinstance(random_seed, tuple | list): warnings.warn( From 50e034b72f17507b904a2315eecc29d7545b1c29 Mon Sep 17 00:00:00 2001 From: Ricardo Vieira Date: Thu, 5 Dec 2024 17:18:02 +0100 Subject: [PATCH 4/4] Fix test incompatibility with newer PyTensor check --- tests/distributions/test_custom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/distributions/test_custom.py b/tests/distributions/test_custom.py index 5b1de16178..5f2cef54f0 100644 --- a/tests/distributions/test_custom.py +++ b/tests/distributions/test_custom.py @@ -287,7 +287,7 @@ def test_multivariate_insufficient_signature(self): with pytest.raises( NotImplementedError, match="signature is not sufficient to infer the support shape" ): - CustomDist.dist(signature="(n)->(m)") + CustomDist.dist([0], signature="(n)->(m)") class TestCustomSymbolicDist: