Teh 2010 - Blackwell-MacQueen Urn and Chinese Restaurant Process
Summary
Integrating out gives a Polya-urn predictive rule for and, on the induced partition of , the Chinese restaurant process. New-cluster probability at step is , so the expected number of clusters is .
Overview
Because DP posteriors are DPs, the marginal predictive of a new draw is available in closed form. This also gives the clustering behaviour exploited by DP mixture samplers.
Main Content
Blackwell-MacQueen predictive (Teh Eqs. 5-6)
where are the distinct values and their counts (Eq. 10).
Urn metaphor. Colours are values in . With probability draw a new colour from , paint a ball and drop it in; with probability pull a random ball, paint a new ball the same colour and return both. Existence proof: the product is infinitely exchangeable (permutation invariance, Eq. 8), so de Finetti (Eq. 9) yields a random , namely the DP.
Chinese restaurant process
If is smooth, ties among induce a random partition of . Sequentially, customer joins existing table with probability and opens a new table with probability . The partition probability is exchangeable.
Rich-gets-richer: large clusters grow faster. Round tables also encode a distribution over permutations (each table a cycle). The law first appeared in population genetics as the Ewens sampling formula (1972); the name CRP is due to Dubins and Pitman.
Number of clusters (Teh Eqs. 11-12)
Let be the number of occupied tables among customers. New table at step occurs independently with probability , so
Proof: , a sum of independent Bernoullis with ; mean and variance follow, and is a digamma difference. (The variance expression is .)
Examples
Prior on K for 100 customers
: . : . A quick simulation (below) reproduces 5.2 for . This is the “implied prior on the number of clusters” examined in E26.
import numpy as np
from scipy.special import digamma
rng = np.random.default_rng(0)
def crp(n, a):
counts = []
for _ in range(n):
p = np.array(counts + [a], float); p /= p.sum()
k = rng.choice(len(p), p=p)
counts.append(1) if k == len(counts) else counts.__setitem__(k, counts[k] + 1)
return counts
a, n = 1.0, 100
print(a * (digamma(a + n) - digamma(a))) # 5.19
print(np.mean([len(crp(n, a)) for _ in range(300)])) # ~5.2PyMC-style sketch (untested)
# CRP prior on K is implicit; with a truncated stick-breaking DP see
# the Stick-Breaking Construction note. To put a prior on alpha:
# alpha = pm.Gamma("alpha", 1.0, 1.0) # then E[K | n, alpha] = alpha * (digamma(alpha+n)-digamma(alpha))Connections
EPPF form and its two-parameter generalisation: De Blasi 2015 - EPPF and Predictive Structure. CRP as the exchangeable partition law behind IBP’s derivation: Griffiths 2011 - Infinite Mixtures and the CRP Review.
See Also
Teh 2010 - Stick-Breaking Construction, Teh 2010 - Dirichlet Process - Overview