algorithmfoundry/Foundry

Sampling from Dirichlet distribution is slow for large alpha values

Closed this issue · 1 comments

The performance of sampling from a Dirichlet is slow when there are large alpha values.

A toy example (Scala):

import gov.sandia.cognition.statistics.distribution.DirichletDistribution
import gov.sandia.cognition.math.matrix.{Vector, VectorFactory}
val vectorFactory = VectorFactory.getDenseDefault()
val alpha = vectorFactory.copyArray(Array(20E8, 10E8, 5E8))
val dirichletDist = new DirichletDistribution(alpha)
dirichletDist.sample(new java.util.Random)

(The same happens with smaller alpha values but a longer vector too)