commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex D Herbert (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (RNG-99) AliasMethodDiscreteSampler
Date Wed, 01 May 2019 13:30:00 GMT

     [ https://issues.apache.org/jira/browse/RNG-99?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Alex D Herbert updated RNG-99:
------------------------------
    Description: 
>From Wikipedia:

[Alias Method|https://en.wikipedia.org/wiki/Alias_method]
{noformat}
In computing, the alias method is a family of efficient algorithms for sampling from
a discrete probability distribution, due to A. J. Walker. That is, it returns integer
values 1 ≤ i ≤ n according to some arbitrary probability distribution. The algorithms
typically use O(n log n) or O(n) preprocessing time, after which random values can
be drawn from the distribution in O(1) time.
{noformat}
Create a sampler using the Alias method:
{code:java}
package org.apache.commons.rng.sampling.distribution;

public class AliasMethodDiscreteSampler implements DiscreteSampler {
    public AliasMethodDiscreteSampler(UniformRandomProvider rng, 
                                      double[] probabilities) {
        // Validate probabilities sum to >0
        // Construct alias tables
    }
    @Override
    public int sample() {
        // Sample from alias tables
    }
}
{code}

  was:
>From Wikipedia:

[Alias Method|https://en.wikipedia.org/wiki/Alias_method]
{noformat}
In computing, the alias method is a family of efficient algorithms for sampling from a discrete
probability distribution, due to A. J. Walker. That is, it returns integer values 1 ≤ i
≤ n according to some arbitrary probability distribution. The algorithms typically use O(n
log n) or O(n) preprocessing time, after which random values can be drawn from the distribution
in O(1) time.
{noformat}
Create a sampler using the Alias method:
{code:java}
package org.apache.commons.rng.sampling.distribution;

public class AliasMethodDiscreteSampler implements DiscreteSampler {
    public AliasMethodDiscreteSampler(UniformRandomProvider rng, 
                                      double[] probabilities) {
        // Validate probabilities sum to >0
        // Construct alias tables
    }
    @Override
    public int sample() {
        // Sample from alias tables
    }
}
{code}


> AliasMethodDiscreteSampler
> --------------------------
>
>                 Key: RNG-99
>                 URL: https://issues.apache.org/jira/browse/RNG-99
>             Project: Commons RNG
>          Issue Type: New Feature
>          Components: sampling
>    Affects Versions: 1.3
>            Reporter: Alex D Herbert
>            Assignee: Alex D Herbert
>            Priority: Minor
>             Fix For: 1.3
>
>
> From Wikipedia:
> [Alias Method|https://en.wikipedia.org/wiki/Alias_method]
> {noformat}
> In computing, the alias method is a family of efficient algorithms for sampling from
> a discrete probability distribution, due to A. J. Walker. That is, it returns integer
> values 1 ≤ i ≤ n according to some arbitrary probability distribution. The algorithms
> typically use O(n log n) or O(n) preprocessing time, after which random values can
> be drawn from the distribution in O(1) time.
> {noformat}
> Create a sampler using the Alias method:
> {code:java}
> package org.apache.commons.rng.sampling.distribution;
> public class AliasMethodDiscreteSampler implements DiscreteSampler {
>     public AliasMethodDiscreteSampler(UniformRandomProvider rng, 
>                                       double[] probabilities) {
>         // Validate probabilities sum to >0
>         // Construct alias tables
>     }
>     @Override
>     public int sample() {
>         // Sample from alias tables
>     }
> }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message