commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Otmar Ertl (JIRA)" <>
Subject [jira] [Updated] (MATH-1220) More efficient sample() method for ZipfDistribution
Date Sun, 09 Aug 2015 15:47:45 GMT


Otmar Ertl updated MATH-1220:
    Attachment: patch_v3

I have revised the patch that makes use of rejection-inversion sampling. I have improved documentation
and inlined a proof that shows that the generated random numbers are really Zipf distributed.
I think the new approach should be more comprehensible now. I would be grateful for a review.

> More efficient sample() method for ZipfDistribution
> ---------------------------------------------------
>                 Key: MATH-1220
>                 URL:
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Otmar Ertl
>             Fix For: 4.0, 3.6
>         Attachments: Zipf Rejection Inversion Sampling Notes.pdf, patch_v1, patch_v2,
> Currently, sampling from a ZipfDistribution is very inefficient. Random values are generated
by inverting the CDF. However, the current implementation uses O(N) power function evaluations
to calculate the CDF for some point. (Here N is the number of points of the Zipf distribution.)
I propose to use rejection sampling instead, which allows the generation of a single random
value in constant time.

This message was sent by Atlassian JIRA

View raw message