Skip to content
BIASED

Dirichlet processes

Block 1 of 8~3 min

A mixture with unknown $K$

The topic Gaussian processes put a prior on functions, and the model grew with the data: every new input added a new value to the prior. For clustering we need the same trick one level up, a prior over partitions of the data.

Recall the two-component Gaussian mixture of the topic EM and Bayesian PCA. EM fitted it well, but we had to choose K=2K = 2 before seeing the data. In practice one fits several KK and compares them by BIC or by evidence (the topic Bayesian model selection). Can the number of clusters instead be inferred together with everything else, and grow when more data arrive?

The first tool is the Dirichlet distribution, the multi-outcome version of the Beta. A vector π=(π1,…,πK)\pi = (\pi_1, \dots, \pi_K) on the simplex (πk≥0\pi_k \ge 0, ∑kπk=1\sum_k \pi_k = 1) has the density

Dir⁡(π∣a1,…,aK)=Γ(a0)∏kΓ(ak)∏k=1Kπkak−1,a0=∑kak.\operatorname{Dir}(\pi \mid a_1, \dots, a_K) = \frac{\Gamma(a_0)}{\prod_k \Gamma(a_k)} \prod_{k=1}^K \pi_k^{a_k - 1}, \qquad a_0 = \sum_k a_k .

Three facts are enough for this topic:

  • the mean is E[πk]=ak/a0\mathbb E[\pi_k] = a_k / a_0, and with K=2K = 2 the Dirichlet is exactly Beta⁡(a1,a2)\operatorname{Beta}(a_1, a_2);
  • aggregation: merging components adds their parameters, e.g. (π1+π2,π3)∼Dir⁡(a1+a2,a3)(\pi_1 + \pi_2, \pi_3) \sim \operatorname{Dir}(a_1 + a_2, a_3);
  • conjugacy with categorical labels: after counts n1,…,nKn_1, \dots, n_K the posterior is Dir⁡(a1+n1,…,aK+nK)\operatorname{Dir}(a_1 + n_1, \dots, a_K + n_K).

Now a finite Bayesian mixture with symmetric weights:

π∼Dir⁡(α/K,…,α/K),θk∼H,zi∣π∼Cat⁡(π),xi∣zi∼F(θzi).\pi \sim \operatorname{Dir}(\alpha/K, \dots, \alpha/K), \qquad \theta_k \sim H, \qquad z_i \mid \pi \sim \operatorname{Cat}(\pi), \qquad x_i \mid z_i \sim F(\theta_{z_i}).

Here HH is the base distribution of cluster parameters and FF the likelihood of one cluster; with FF Gaussian this is the mixture from EM with priors added. Integrating π\pi out gives the posterior predictive of the next label, the posterior mean of πk\pi_k:

p(zn+1=k∣z1,…,zn)=nk+α/Kn+α.p(z_{n+1} = k \mid z_1, \dots, z_n) = \frac{n_k + \alpha/K}{n + \alpha}.

With K=2K = 2 and α/K=1\alpha/K = 1 this is the coin from the topic The Bayesian approach: three heads give (3+1)/(3+2)=4/5(3 + 1)/(3 + 2) = 4/5.

Answers are saved on the server and tied to this browser until you sign in.