## Everything you need to know about the Dirichlet distribution

The Dirichlet distribution is a generalization of the beta distribution. In Bayesian statistics, it is commonly used as the conjugate prior to the multinomial distribution, hence it can be used to model the uncertainty of a random vector of probabilities. It has a wide range of applications including Bayesian analysis, text mining, statistical genetics, and nonparametric inference. This article gives an intuitive introduction to Dirichlet distribution and shows how it is connected to the multinomial distribution. In addition, it shows how it can be modeled and visualized in Python.

**Definition**

Suppose that the continuous random variables *X*₁, *X*₂, …*Xₖ* (*k*≥2) form the random vector ** X** defined as:

We also define the vector ** α** as:

where

Now the random vector ** X** is said to have

*Dirichlet distribution*with parameter

**if it has the following joint PDF:**

*α*The function B(** α**) is called the

*multivariate*

*beta function*and is defined as

where Г(*x*) is the gamma function. If the random vector ** X** has a Dirichlet distribution with parameter

**, it is denoted by**

*α***~ Dir(**

*X***). The multivariate beta function is included in the joint PDF to normalize it. The joint PDF should integrate to 1 over its domain:**

*α*Hence, we have:

Based on Equation 1, the values that the random variables *X*₁, *X*₂, …*Xₖ *take should meet the following conditions to have *f***ₓ**(** x**)>0:

These conditions define the *support* of the Dirichlet distribution. The support of ** X**, and of its distribution, is the set of all

**(the values that**

*x***can take) where**

*X**f*

**ₓ**(

**)>0. If**

*x***has**

*X**k*elements, the support of

**with a Dirichlet distribution is a**

*X**k*-1 dimensional

*simplex*. A simplex is a bounded linear manifold that is created because of the constraints of Equation 3. A simplex is the generalization of the notion of a triangle to higher dimensions. Hence, a

*k*-1…

This post originally appeared on TechToday.