[
https://issues.apache.org/jira/browse/RNG-156?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Alex Herbert resolved RNG-156.
------------------------------
Fix Version/s: 1.4
Resolution: Implemented
Added in commit:
b930e7ba3e6c5c623d2c04c3100b8dcdd2bba239
> Dirichlet distribution sampler
> ------------------------------
>
> Key: RNG-156
> URL: https://issues.apache.org/jira/browse/RNG-156
> Project: Commons RNG
> Issue Type: New Feature
> Components: sampling
> Affects Versions: 1.4
> Reporter: Alex Herbert
> Priority: Minor
> Fix For: 1.4
>
> Time Spent: 40m
> Remaining Estimate: 0h
>
> Add sampling from a [Dirichlet
> distribution|https://en.wikipedia.org/wiki/Dirichlet_distribution#Random_number_generation].
> Samples can be produced by generating Gamma(shape=alpha, scale=1) deviates
> for each category with concentration alpha, summing the deviates and dividing
> by the sum.
> Proposed public API.
> {code:java}
> public abstract class DirichletSampler
> implements SharedStateObjectSampler<double[]> {
> public double[] sample();
> public DirichletSampler withUniformRandomProvider(UniformRandomProvider
> rng);
> public static DirichletSampler of(UniformRandomProvider rng,
> double... alpha);
> public static DirichletSampler symmetric(UniformRandomProvider rng,
> int k,
> double alpha);
> }
> {code}
> The symmetric case is a special case where the alpha concentration parameters
> are the same for all categories. This can be implemented with a single
> sampler which reduces memory footprint. This is especially true when alpha >
> 1 as a AhrensDieterMarsagliaTsangGammaSampler holds two precomputed values
> and a normalised Gaussian sampler.
> An example of using a symmetric case is a unit Simplex which uses dimension k
> and alpha=1.
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)