Skip to content

Commit cc47288

Browse files
committed
Add warning about changed behavior when passing Sequence for random_seed
1 parent b4ae018 commit cc47288

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

pymc/sampling/mcmc.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -528,10 +528,8 @@ def sample(
528528
random_seed : int, array-like of int, or Generator, optional
529529
Random seed(s) used by the sampling steps. Each step will create its own
530530
:py:class:`~numpy.random.Generator` object to make its random draws in a way that is
531-
indepedent from all other steppers and all other chains. If a list, tuple or array of ints
532-
is passed, each entry will be used to seed the creation of ``Generator`` objects.
533-
A ``ValueError`` will be raised if the length does not match the number of chains.
534-
A ``TypeError`` will be raised if a :py:class:`~numpy.random.RandomState` object is passed.
531+
indepedent from all other steppers and all other chains.
532+
A ``TypeError`` will be raised if a legacy :py:class:`~numpy.random.RandomState` object is passed.
535533
We no longer support ``RandomState`` objects because their seeding mechanism does not allow
536534
easy spawning of new independent random streams that are needed by the step methods.
537535
progressbar : bool, optional default=True
@@ -730,6 +728,12 @@ def joined_blas_limiter():
730728

731729
if random_seed == -1:
732730
random_seed = None
731+
elif isinstance(random_seed, tuple | list):
732+
warnings.warn(
733+
"A list or tuple of random_seed no longer specifies the specific random_seed of each chain. "
734+
"Use a single seed instead.",
735+
UserWarning,
736+
)
733737
rngs = get_random_generator(random_seed).spawn(chains)
734738
random_seed_list = [rng.integers(2**30) for rng in rngs]
735739

0 commit comments

Comments
 (0)