-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
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
quick solution to Bounded sampling of arbitrary shapes #1069
Conversation
i, n = 0, len(samples) | ||
while i < len(samples): | ||
sample = self.dist.random(point=point, size=n) | ||
q, r = divmod(n, shape_len) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just realized that this was left over from an attempt to make _random
behave as it used to; specifically, when it took the size
parameter. My initial implementation had samples
take the shape size + tuple(self.shape)
, then code would produce the desired result from this method alone. However, after looking into the generating_samples
function, I noticed that it takes steps to produce replications with shape given by size
.
I think this build stopped for some reason. I restarted it and we'll see what happens. |
$ python setup.py build_ext --inplace |
This appears to be caused by the high rejection rate for the (new) default non-i.i.d. truncated sampler under the test dimensions. |
|
Glad I added that new test! Looks like there's more I need understand about In that test, the distribution has no shape and random is called with Most other RVs that call I could return to an earlier implementation that uses the |
The features necessary to fix these issues are being pieced together in #1125. |
Any update on this? |
@springcoil, I've tied some important parts of this into PR #1125. Simply put, in order to properly sample multivariate truncated variables using accept/reject, we need to know the exact dimensions of the support and "size/dimension of the broadcast". See my recent comments in that PR for more details. |
Closing because of age. Feel free to reopen if you want to fix this up. |
Proposed fix for #1068.