-
Notifications
You must be signed in to change notification settings - Fork 421
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
Define Random.Sampler
#1314
Define Random.Sampler
#1314
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1314 +/- ##
==========================================
+ Coverage 81.48% 81.51% +0.02%
==========================================
Files 115 115
Lines 6623 6626 +3
==========================================
+ Hits 5397 5401 +4
+ Misses 1226 1225 -1
Continue to review full report at Codecov.
|
All good here, I haven't looked at the API, but simplifying things in Distributions itself wouldn't hurt so if the Random.Sampler API is redundant we could only keep this one. |
I opened an issue: #1316 |
@devmotion we can merge this one too for the release |
OK, I fixed the merge conflict. I can merge and tag 0.25 if the tests pass? |
yes absolutely |
This PR defines
Random.Sampler
forSampleable
s.Motivation:
Recently I updated ConsistencyResampling and switched to the Random API. The package now works with all distributions for which the Random interface is implemented. Unfortunately, I noticed that it is not possible to use Distributions without committing type piracy since
Random.Sampler
is not implemented (an example of this "fix" is shown in https://devmotion.github.io/ConsistencyResampling.jl/dev/supported/#Vectors-of-distributions).Follow-up:
There are some questions that could lead to additional PRs:
sampler
still needed or should one switch toRandom.Sampler
completely and deprecatesampler
?rand!(rng, x, sampler)
whereas Distributions supportsrand!(rng, sampler, x)
. Since it is not relevant for my use case I did not touch it in this PR but, if desired, one could implementrand!(rng, x, sampler)
as well and possibly deprecaterand!(rng, sampler, x)
.