public abstract class DirichletSampler extends Object implements SharedStateObjectSampler<double[]>
Sampling uses:
| Modifier and Type | Method and Description |
|---|---|
protected abstract int |
getK()
Gets the number of categories.
|
protected abstract double |
nextGamma(int category)
Create a gamma sample for the given category.
|
static DirichletSampler |
of(UniformRandomProvider rng,
double... alpha)
Creates a new Dirichlet distribution sampler.
|
double[] |
sample()
Create an object sample.
|
static DirichletSampler |
symmetric(UniformRandomProvider rng,
int k,
double alpha)
Creates a new symmetric Dirichlet distribution sampler using the same concentration
parameter for each category.
|
String |
toString() |
abstract DirichletSampler |
withUniformRandomProvider(UniformRandomProvider rng)
Create a new instance of the sampler with the same underlying state using the given
uniform random provider as the source of randomness.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitsamples, samplespublic double[] sample()
ObjectSamplersample in interface ObjectSampler<double[]>protected abstract int getK()
protected abstract double nextGamma(int category)
category - Category.public abstract DirichletSampler withUniformRandomProvider(UniformRandomProvider rng)
withUniformRandomProvider in interface SharedStateSampler<SharedStateObjectSampler<double[]>>rng - Generator of uniformly distributed random numbers.public static DirichletSampler of(UniformRandomProvider rng, double... alpha)
rng - Generator of uniformly distributed random numbers.alpha - Concentration parameters.IllegalArgumentException - if the number of concentration parameters
is less than 2; or if any concentration parameter is not strictly positive.public static DirichletSampler symmetric(UniformRandomProvider rng, int k, double alpha)
rng - Generator of uniformly distributed random numbers.k - Number of categories.alpha - Concentration parameter.IllegalArgumentException - if the number of categories is
less than 2; or if the concentration parameter is not strictly positive.Copyright © 2016–2022 The Apache Software Foundation. All rights reserved.