You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
importnumpyasnpimportscipy.specialasspimportpymcaspmrng=np.random.default_rng(123)
# Simulate mean from an only-intercept model. 2 chains, 100 draws, 5 observations.# So 'mu' is the same for all the observations (because it's intercept-only)mu_draws=np.abs(150+np.dstack([rng.normal(size=(2, 100, 1))] *5))
# Simulate some alpha valuesalpha_draws=np.abs(rng.normal(size=(2, 100, 1)))
# With 'mu' and 'alpha' get 'beta', which is what pm.Weibull needsbeta_draws=mu_draws/sp.gamma(1+1/alpha_draws)
# See the draws, for a given chain and draw, they look all the same!weibull_draws=pm.draw(pm.Weibull.dist(alpha=alpha_draws, beta=beta_draws))
weibull_drawsprint((weibull_draws==weibull_draws[:, :, 0][..., None]).all())
# True --> they're in fact all the same
You can see this is not the case for the gamma distribution
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.
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()
bambinos/bambi#788
The text was updated successfully, but these errors were encountered: