fwildclusterboot icon indicating copy to clipboard operation
fwildclusterboot copied to clipboard

Use dqrng::dqrrademacher

Open s3alfisc opened this issue 2 years ago • 3 comments

  • for performance improvements

s3alfisc avatar Jul 15 '23 13:07 s3alfisc

Anyway I could help with this change?

BTW, I know you have been waiting a long time for weighted sampling in dqrng. For the time being, you could just throw an unfair coin:

                            mammen = function(n) {
                              ifelse(
                                dqrng::dqrunif(n) < (sqrt(5) + 1) / (2 * sqrt(5)),
                                (1 - sqrt(5)) / 2, 
                                (1 + sqrt(5)) / 2 
                              )
                            },

This is slower than you current implementation with sample(), but it would be controlled by the same state / seed as the other "dqrng" weights.

rstub avatar Apr 16 '24 13:04 rstub

Hi @rstub - this is already implemented =) I am only waiting for me to address a few changes for an ropensci review yet.

Changing the Mammen weights as in your suggestions sounds like a great plan. I'd be happy to accept a PR but can also just implement it myself =) I definitely agree that seed state uniformity definitely beats performance in this case!

Best, Alex

s3alfisc avatar Apr 16 '24 19:04 s3alfisc

OK, I got confused by the two closed PRs. Great if things are working already. I think it is easier if you do the changes for the Mammen weights on your end. I might contribute a (faster) C++ version once the upcoming {dqrng} release is on CRAN.

rstub avatar Apr 17 '24 08:04 rstub