Replaces the Poisson rejection method implementation#1560
Replaces the Poisson rejection method implementation#1560benjamin-lieser merged 13 commits intorust-random:masterfrom
Conversation
|
This test fails The sampled mean is 14.7370005, which should be within the 99% confidence interval of poisson mean, and it passes the ks test with |
|
I expect that test is less useful than the KS test, so feel free to remove it. This PR should also enable KS tests for larger lambda? |
|
I randomly tested between 10 and 1000. I also tested for |
There was a problem hiding this comment.
I have checked the code and it does seems to match the verbal description in the paper, I really can't read fortran. I have not checked the math in the paper.
The simple avg_test can be safely ignored in my opinion.
I would add a few more values to the KS test
let parameters = [0.1, 1.0, 7.5, 45.0, 98.0, 230.0, 4567.5, 4.4541e7];
|
Can you add the changelog? |
|
Thanks @benjamin-lieser and @JamboChen! I'll go ahead with the release. |
- [x] Added a `CHANGELOG.md` entry # Summary As discussed in rust-random#1515, this PR replaces the implementation of `poisson::RejectionMethod` with a new algorithm based on the [paper ](https://dl.acm.org/doi/10.1145/355993.355997). # Motivation The new implementation offers improved performance and maintains better sampling distribution, especially for extreme values of lambda (> 1e9). # Details In terms of performance, here are the benchmarks I ran, with the current implementation as the baseline: ```text poisson/100 time: [45.5242 cycles 45.6734 cycles 45.8337 cycles] change: [-86.572% -86.507% -86.438%] (p = 0.00 < 0.05) Performance has improved. Found 5 outliers among 100 measurements (5.00%) 2 (2.00%) low mild 2 (2.00%) high mild 1 (1.00%) high severe poisson/variable time: [5494.6626 cycles 5508.2882 cycles 5523.2298 cycles] thrpt: [5523.2298 cycles/100 5508.2882 cycles/100 5494.6626 cycles/100] change: time: [-76.728% -76.573% -76.430%] (p = 0.00 < 0.05) thrpt: [+324.27% +326.85% +329.69%] Performance has improved. Found 5 outliers among 100 measurements (5.00%) 1 (1.00%) low mild 3 (3.00%) high mild 1 (1.00%) high severe ```
- [x] Added a `CHANGELOG.md` entry # Summary As discussed in rust-random#1515, this PR replaces the implementation of `poisson::RejectionMethod` with a new algorithm based on the [paper ](https://dl.acm.org/doi/10.1145/355993.355997). # Motivation The new implementation offers improved performance and maintains better sampling distribution, especially for extreme values of lambda (> 1e9). # Details In terms of performance, here are the benchmarks I ran, with the current implementation as the baseline: ```text poisson/100 time: [45.5242 cycles 45.6734 cycles 45.8337 cycles] change: [-86.572% -86.507% -86.438%] (p = 0.00 < 0.05) Performance has improved. Found 5 outliers among 100 measurements (5.00%) 2 (2.00%) low mild 2 (2.00%) high mild 1 (1.00%) high severe poisson/variable time: [5494.6626 cycles 5508.2882 cycles 5523.2298 cycles] thrpt: [5523.2298 cycles/100 5508.2882 cycles/100 5494.6626 cycles/100] change: time: [-76.728% -76.573% -76.430%] (p = 0.00 < 0.05) thrpt: [+324.27% +326.85% +329.69%] Performance has improved. Found 5 outliers among 100 measurements (5.00%) 1 (1.00%) low mild 3 (3.00%) high mild 1 (1.00%) high severe ```
CHANGELOG.mdentrySummary
As discussed in #1515, this PR replaces the implementation of
poisson::RejectionMethodwith a new algorithm based on the paper .Motivation
The new implementation offers improved performance and maintains better sampling distribution, especially for extreme values of lambda (> 1e9).
Details
In terms of performance, here are the benchmarks I ran, with the current implementation as the baseline: