Closed tomicapretto closed 2 months ago
I think this is where the problem occurs:
See below
import numpy as np
rng = np.random.default_rng(1234)
alpha = np.abs(rng.normal(size=(100, 20, 1)))
beta = np.abs(np.dstack([rng.normal(size=(100, 20, 1))] * 5))
alpha_draws = rng.weibull(alpha, size=None)
alpha_draws.shape # (100, 20, 1)
np.asarray(beta * alpha_draws).shape # (100, 20, 5)
But it's reusing the same that's sampled from rng.weibull
along the last axis, and since beta
is constant along that axis, the sampled values are repeated.
Probably needs a
if size is None:
size = np.broadcast_shapes(alpha.shape, beta.shape)
(Untested code)
Describe the issue:
The generation of random draws from a Weibull distribution is returning the same values when the input is constant along some axis. This does not happen with other distributions such as the Gamma. See the example below.
Reproduceable code example:
You can see this is not the case for the gamma distribution
Error message:
No response
PyMC version information:
5.11.0
Context for the issue:
Someone reported this in Bambi after they saw a warning with
az.plot_ppc()
https://github.com/bambinos/bambi/discussions/788