SciPy

scipy.stats.dirichlet

scipy.stats.dirichlet = <scipy.stats._multivariate.dirichlet_gen object at 0x7f61694e7b10>[source]

A Dirichlet random variable.

The alpha keyword specifies the concentration parameters of the distribution.

New in version 0.15.0.

Parameters:

x : array_like

Quantiles, with the last axis of x denoting the components.

alpha : array_like

The concentration parameters. The number of entries determines the dimensionality of the distribution.

Alternatively, the object may be called (as a function) to fix

concentration parameters, returning a “frozen” Dirichlet

random variable:

rv = dirichlet(alpha)

  • Frozen object with the same methods but holding the given concentration parameters fixed.

Notes

Each \(\alpha\) entry must be positive. The distribution has only support on the simplex defined by

\[\sum_{i=1}^{K} x_i \le 1\]

The probability density function for dirichlet is

\[f(x) = \frac{1}{\mathrm{B}(\boldsymbol\alpha)} \prod_{i=1}^K x_i^{\alpha_i - 1}\]

where

\[\mathrm{B}(\boldsymbol\alpha) = \frac{\prod_{i=1}^K \Gamma(\alpha_i)}{\Gamma\bigl(\sum_{i=1}^K \alpha_i\bigr)}\]

and \(\boldsymbol\alpha=(\alpha_1,\ldots,\alpha_K)\), the concentration parameters and \(K\) is the dimension of the space where \(x\) takes values.

Methods

pdf(x, alpha) Probability density function.
logpdf(x, alpha) Log of the probability density function.
rvs(alpha, size=1) Draw random samples from a Dirichlet distribution.
mean(alpha) The mean of the Dirichlet distribution
var(alpha) The variance of the Dirichlet distribution
entropy(alpha) Compute the differential entropy of the multivariate normal.