-
Notifications
You must be signed in to change notification settings - Fork 8
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
weighted sampling #18
Comments
Thanks for the suggestion! I am still interested in adding Some general comments:
|
BTW, in the original paper the timings look much better for the StochasticAcceptance algorithm, being faster than BisectionSearch even without the (IMO) artificial change in weights. I guess that for the python examples the bisection algorithm is implemented in compiled code, while the other two are implemented in python. |
All right, if I get around to doing this (not likely to be soon), I'll see about putting together a PR - I have something I'm working on that could use something similar (in C) and it might be easy to get it into a form compatible with this project.
|
I am finally working on this: https://stubner.me/2022/12/roulette-wheel-selection-for-dqrng/, looks promising. |
As noted in #52, there are some more things I need to consider w.r.t. to weighted sampling. I will have to back out that code for now in order to release the other changes that have accumulated. |
I ran into this thread (http://r.789695.n4.nabble.com/Bias-in-R-s-random-integers-td4752563.html) and saw your discussion of the sample feature - I have a suggestion if you're still thinking of implementing it: you could do stochastic acceptance in order to perform weighted sampling in this framework. See here for an example: https://jbn.github.io/fast_proportional_selection/ It has the overhead of having to find the maximum weight and burns at least one more call to runif(), but you might provide an optional argument of max weight to spare the need for searching - this can also be done so that the weights don't have to add up to 1 (ie sparing the user the need to add up and divide by the sum). When I have time I might be able to submit a pull request if you are interested and if I don't forget, as I have a use for something similar
The text was updated successfully, but these errors were encountered: