Skip to content

dirichlet

dirichlet(options): Sampler<number[]>

Defined in: src/distribution/continuous/simplex.ts:24

Dirichlet: a point on the simplex, so the values are in (0, 1) and sum to 1. The usual prior over a categorical distribution.

DirichletOptions

Sampler<number[]>

const d = dirichlet({ alpha: [1, 1, 1] });
d.sample(); // [ 0.24, 0.51, 0.25 ]