We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dirichlet.random appears to have some shape issues.
Dirichlet.random
import numpy as np import pymc3 as pm dir_dist = pm.Dirichlet.dist(np.r_[1, 1]) dir_dist.random()
[[0.47011506 0.52988494] [0.38131591 0.61868409]]
The output has too many dimensions.
Specifying size=1 only adds another dimension:
size=1
dir_dist.random(size=1)
[[[0.46690176 0.53309824] [0.01646167 0.98353833]]]
The output starts to look correct around here:
dir_dist.random(size=2)
[[0.18456125 0.81543875] [0.26424679 0.73575321]]
Larger values of size aren't any better:
size
dir_dist.random(size=3)
[[[0.46520733 0.53479267] [0.44132648 0.55867352]] [[0.69477003 0.30522997] [0.3173439 0.6826561 ]] [[0.82510178 0.17489822] [0.98854784 0.01145216]]]
If we set the shape explicitly, things seem to improve in the size=None case:
shape
size=None
dir_dist = pm.Dirichlet.dist(np.r_[1, 1], shape=2) dir_dist.random()
[0.01529536 0.98470464]
Unfortunately, things get weird when size == 2.
size == 2
[1. 1.]
The text was updated successfully, but these errors were encountered:
Just as a sanity check, scipy has "correct" behavior. Not sure why distribution shape tests didn't catch...
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Dirichlet.random
appears to have some shape issues.The output has too many dimensions.
Specifying
size=1
only adds another dimension:The output starts to look correct around here:
Larger values of
size
aren't any better:If we set the
shape
explicitly, things seem to improve in thesize=None
case:Unfortunately, things get weird when
size == 2
.Versions and main components
The text was updated successfully, but these errors were encountered: