Chinese restaurant process

From HandWiki
Short description: Discrete-time stochastic process

In probability theory, the Chinese restaurant process is a discrete-time stochastic process, analogous to seating customers at tables in a restaurant. Imagine a restaurant with an infinite number of circular tables, each with infinite capacity. Customer 1 sits at the first table. The next customer either sits at the same table as customer 1, or the next table. This continues, with each customer choosing to either sit at an occupied table with a probability proportional to the number of customers already there (i.e., they are more likely to sit at a table with many customers than few), or an unoccupied table. At time n, the n customers have been partitioned among m ≤ n tables (or blocks of the partition). The results of this process are exchangeable, meaning the order in which the customers sit does not affect the probability of the final distribution. This property greatly simplifies a number of problems in population genetics, linguistic analysis, and image recognition.

The restaurant analogy first appeared in a 1985 write-up by David Aldous,[1] where it was attributed to Jim Pitman (who additionally credits Lester Dubins).[2]

Formal definition

For any positive integer [math]\displaystyle{ n }[/math], let [math]\displaystyle{ \mathcal{P}_{n} }[/math] denote the set of all partitions of the set [math]\displaystyle{ \{ 1, 2, 3,..., n \} \triangleq [n] }[/math]. The Chinese restaurant process takes values in the infinite Cartesian product [math]\displaystyle{ \prod_{n \geq 1} \mathcal{P}_{n} }[/math].

The value of the process at time [math]\displaystyle{ n }[/math] is a partition [math]\displaystyle{ B_n }[/math] of the set [math]\displaystyle{ [n] }[/math], whose probability distribution is determined as follows. At time [math]\displaystyle{ n=1 }[/math], the trivial partition [math]\displaystyle{ B_1 = \{ \{ 1 \} \} }[/math] is obtained (with probability one). At time [math]\displaystyle{ n+1 }[/math] the element "[math]\displaystyle{ n+1 }[/math]" is either:

  1. added to one of the blocks of the partition [math]\displaystyle{ B_n }[/math], where each block is chosen with probability [math]\displaystyle{ |b|/(n+1) }[/math] where [math]\displaystyle{ |b| }[/math] is the size of the block (i.e. number of elements), or
  2. added to the partition [math]\displaystyle{ B_n }[/math] as a new singleton block, with probability [math]\displaystyle{ 1/(n+1) }[/math].

The random partition so generated has some special properties. It is exchangeable in the sense that relabeling [math]\displaystyle{ \{ 1,..., n \} }[/math] does not change the distribution of the partition, and it is consistent in the sense that the law of the partition of [math]\displaystyle{ [n-1] }[/math] obtained by removing the element [math]\displaystyle{ n }[/math] from the random partition [math]\displaystyle{ B_n }[/math] is the same as the law of the random partition [math]\displaystyle{ B_{n-1} }[/math].

The probability assigned to any particular partition (ignoring the order in which customers sit around any particular table) is

[math]\displaystyle{ \Pr(B_n = B) = \frac{\prod_{b\in B} (|b| -1)!}{n!}, \qquad B \in \mathcal{P}_{n} }[/math]

where [math]\displaystyle{ b }[/math] is a block in the partition [math]\displaystyle{ B }[/math] and [math]\displaystyle{ |b| }[/math] is the size of [math]\displaystyle{ b }[/math].

The definition can be generalized by introducing a parameter [math]\displaystyle{ \theta\gt 0 }[/math] which modifies the probability of the new customer sitting at a new table to [math]\displaystyle{ \frac{\theta}{n+\theta} }[/math] and correspondingly modifies the probability of them sitting at a table of size [math]\displaystyle{ |b| }[/math] to [math]\displaystyle{ \frac{|b|}{n+\theta} }[/math]. The vanilla process introduced above can be recovered by setting [math]\displaystyle{ \theta=1 }[/math]. Intuitively, [math]\displaystyle{ \theta }[/math] can be interpreted as the effective number of customers sitting at the first empty table.

Alternative definition

An equivalent, but subtly different way to define the Chinese restaurant process, is to let new customers choose companions rather than tables.[3] Customer [math]\displaystyle{ n+1 }[/math] chooses to sit at the same table as any one of the [math]\displaystyle{ n }[/math] seated customers with probability [math]\displaystyle{ \frac{1}{n+\theta} }[/math], or chooses to sit at a new, unoccupied table with probability [math]\displaystyle{ \frac{\theta}{n+\theta} }[/math]. Notice that in this formulation, the customer chooses a table without having to count table occupancies---we don't need [math]\displaystyle{ |b| }[/math].

Distribution of the number of tables

Chinese restaurant table
Parameters

[math]\displaystyle{ \theta \gt 0 }[/math]

[math]\displaystyle{ n \in \{1,2,\ldots \} }[/math]
Support [math]\displaystyle{ k \in \{1,2,\ldots,n\} }[/math]
pmf [math]\displaystyle{ \frac{\Gamma(\theta)}{\Gamma(n+\theta)} |s(n,k)| \theta^{k} }[/math]
Mean [math]\displaystyle{ \theta (\psi(\theta+n)-\psi(\theta)) }[/math]
(see digamma function)

The Chinese restaurant table distribution (CRT) is the probability distribution on the number of tables in the Chinese restaurant process.[4] It can be understood as the sum of [math]\displaystyle{ n }[/math] independent Bernoulli random variables, each with a different parameter:

[math]\displaystyle{ \begin{align} K & = \sum_{i=1}^n b_i \\[4pt] b_i & \sim \operatorname{Bernoulli} \left( \frac \theta {i-1+\theta}\right) \end{align} }[/math]

The probability mass function of [math]\displaystyle{ K }[/math] is given by [5]

[math]\displaystyle{ f(k) = \frac{\Gamma(\theta)}{\Gamma(n+\theta)} |s(n,k)| \theta^k, \quad k=1,\dots,n, }[/math]

where [math]\displaystyle{ s }[/math] denotes Stirling numbers of the first kind.

Generalization

This construction can be generalized to a model with two parameters, [math]\displaystyle{ \theta }[/math] & [math]\displaystyle{ \alpha }[/math],[2][6] commonly called the strength (or concentration) and discount parameters respectively. At time [math]\displaystyle{ n+1 }[/math], the next customer to arrive finds [math]\displaystyle{ |B| }[/math] occupied tables and decides to sit at an empty table with probability

[math]\displaystyle{ \frac{\theta + |B| \alpha}{n + \theta}, }[/math]

or at an occupied table [math]\displaystyle{ b }[/math] of size [math]\displaystyle{ |b| }[/math] with probability

[math]\displaystyle{ \frac{|b| - \alpha}{n + \theta}. }[/math]

In order for the construction to define a valid probability measure it is necessary to suppose that either [math]\displaystyle{ \alpha\lt 0 }[/math] and [math]\displaystyle{ \theta = -L\alpha }[/math] for some [math]\displaystyle{ L \in \{1,2,,...\} }[/math]; or that [math]\displaystyle{ 0\leq\alpha\lt 1 }[/math] and [math]\displaystyle{ \theta\gt -\alpha }[/math].

Under this model the probability assigned to any particular partition [math]\displaystyle{ B }[/math] of [math]\displaystyle{ [n] }[/math], in terms of the Pochhammer k-symbol, is

[math]\displaystyle{ \Pr(B_n = B) = \frac{(\theta + \alpha)_{|B|-1, \alpha}}{(\theta+1)_{n-1, 1}} \prod_{b\in B}(1-\alpha)_{|b|-1, 1} }[/math]

where, by convention, [math]\displaystyle{ (a)_{0,c} = 1 }[/math], and for [math]\displaystyle{ b \gt 0 }[/math]

[math]\displaystyle{ (a)_{b,c} = \prod_{i=0}^{b-1}(a+ic) = \begin{cases} a^b & \text{if }c = 0, \\ \\ \dfrac{c^b\,\Gamma(a/c + b)}{\Gamma(a/c)} & \text{otherwise}. \end{cases} }[/math]

Thus, for the case when [math]\displaystyle{ \theta \gt 0 }[/math] the partition probability can be expressed in terms of the Gamma function as

[math]\displaystyle{ \Pr(B_n = B) =\frac{\Gamma(\theta)}{\Gamma(\theta+n)}\dfrac{\alpha^{|B|}\,\Gamma(\theta/\alpha + |B|) }{\Gamma(\theta/\alpha)}\prod_{b\in B}\dfrac{\Gamma(|b|-\alpha)}{\Gamma(1-\alpha)}. }[/math]

In the one-parameter case, where [math]\displaystyle{ \alpha }[/math] is zero, this simplifies to

[math]\displaystyle{ \Pr(B_n = B) = \frac{\Gamma(\theta)\,\theta^{|B|}}{\Gamma(\theta+n)}\prod_{b\in B} \Gamma(|b|). }[/math]

Or, when [math]\displaystyle{ \theta }[/math] is zero,

[math]\displaystyle{ \Pr(B_n = B) =\frac{\alpha^{|B|-1}\,\Gamma(|B|) }{{\Gamma(n)}}\prod_{b\in B} \frac{\Gamma(|b|-\alpha)}{\Gamma(1-\alpha)}. }[/math]

As before, the probability assigned to any particular partition depends only on the block sizes, so as before the random partition is exchangeable in the sense described above. The consistency property still holds, as before, by construction.

If [math]\displaystyle{ \alpha=0 }[/math], the probability distribution of the random partition of the integer [math]\displaystyle{ n }[/math] thus generated is the Ewens distribution with parameter [math]\displaystyle{ \theta }[/math], used in population genetics and the unified neutral theory of biodiversity.

File:Chinese Restaurant Process for DP(0.5,H).webm

Derivation

Here is one way to derive this partition probability. Let [math]\displaystyle{ C_i }[/math] be the random block into which the number [math]\displaystyle{ i }[/math] is added, for [math]\displaystyle{ i =1,2,3,... }[/math]. Then

[math]\displaystyle{ \Pr(C_i = c\mid C_1,\ldots,C_{i-1}) = \begin{cases} \dfrac{\theta + |B| \alpha }{\theta + i -1} & \text{if }c \in \text{new block}, \\ \\ \dfrac{|b| - \alpha }{\theta + i - 1} & \text{if }c\in b; \end{cases} }[/math]

The probability that [math]\displaystyle{ B_n }[/math] is any particular partition of the set [math]\displaystyle{ \{ 1,...,n \} }[/math] is the product of these probabilities as [math]\displaystyle{ i }[/math] runs from [math]\displaystyle{ 1 }[/math] to [math]\displaystyle{ n }[/math]. Now consider the size of block [math]\displaystyle{ b }[/math]: it increases by one each time we add one element into it. When the last element in block [math]\displaystyle{ b }[/math] is to be added in, the block size is [math]\displaystyle{ |b|-1 }[/math]. For example, consider this sequence of choices: (generate a new block [math]\displaystyle{ b }[/math])(join [math]\displaystyle{ b }[/math])(join [math]\displaystyle{ b }[/math])(join [math]\displaystyle{ b }[/math]). In the end, block [math]\displaystyle{ b }[/math] has 4 elements and the product of the numerators in the above equation gets [math]\displaystyle{ \theta\cdot 1\cdot 2\cdot 3 }[/math]. Following this logic, we obtain [math]\displaystyle{ \Pr(B_n = B) }[/math] as above.

Expected number of tables

For the one parameter case, with [math]\displaystyle{ \alpha=0 }[/math] and [math]\displaystyle{ 0\lt \theta\lt \infty }[/math], the number of tables is distributed according to the chinese restaurant table distribution. The expected value of this random variable, given that there are [math]\displaystyle{ n }[/math] seated customers, is[8]

[math]\displaystyle{ \begin{align} \sum_{k=1}^n \frac \theta {\theta+k-1} = \theta \cdot (\Psi(\theta+n) - \Psi(\theta)) \end{align} }[/math]

where [math]\displaystyle{ \Psi(\theta) }[/math] is the digamma function. In the general case ([math]\displaystyle{ \alpha\gt 0 }[/math]) the expected number of occupied tables is[6]

[math]\displaystyle{ \begin{align} \frac{\Gamma(\theta+n+\alpha)\Gamma(\theta+1)}{\alpha \Gamma(\theta+n) \Gamma(\theta+\alpha)} - \frac \theta \alpha, \end{align} }[/math]

however, note that the [math]\displaystyle{ \Gamma(\cdot) }[/math] function here is not the standard gamma function.[6]

The Indian buffet process

It is possible to adapt the model such that each data point is no longer uniquely associated with a class (i.e., we are no longer constructing a partition), but may be associated with any combination of the classes. This strains the restaurant-tables analogy and so is instead likened to a process in which a series of diners samples from some subset of an infinite selection of dishes on offer at a buffet. The probability that a particular diner samples a particular dish is proportional to the popularity of the dish among diners so far, and in addition the diner may sample from the untested dishes. This has been named the Indian buffet process and can be used to infer latent features in data.[9]

Applications

The Chinese restaurant process is closely connected to Dirichlet processes and Pólya's urn scheme, and therefore useful in applications of Bayesian statistics including nonparametric Bayesian methods. The Generalized Chinese Restaurant Process is closely related to Pitman–Yor process. These processes have been used in many applications, including modeling text, clustering biological microarray data,[10] biodiversity modelling, and image reconstruction [11][12]

See also

References

  1. Aldous, D. J. (1985). "Exchangeability and related topics". École d'Été de Probabilités de Saint-Flour XIII — 1983. Lecture Notes in Mathematics. 1117. pp. 1–198. doi:10.1007/BFb0099421. ISBN 978-3-540-15203-3.  The restaurant process is described on page 92.
  2. 2.0 2.1 Pitman, Jim (1995). "Exchangeable and Partially Exchangeable Random Partitions". Probability Theory and Related Fields 102 (2): 145–158. doi:10.1007/BF01213386. 
  3. Blei, David M.; Frazier, Peter I. (2011). "Distance Dependent Chinese Restaurant Processes". Journal of Machine Learning Research 12: 2461–2488. https://www.jmlr.org/papers/volume12/blei11a/blei11a.pdf. 
  4. Zhou, Mingyuan; Carin, Lawrence (2012). "Negative Binomial Process Count and Mixture Modeling". IEEE Transactions on Pattern Analysis and Machine Intelligence 37 (2): 307–20. doi:10.1109/TPAMI.2013.211. PMID 26353243. Bibcode2012arXiv1209.3442Z. 
  5. Antoniak, Charles E (1974). "Mixtures of Dirichlet processes with applications to Bayesian nonparametric problems". The Annals of Statistics 2 (6): 1152–1174. doi:10.1214/aos/1176342871. 
  6. 6.0 6.1 6.2 Pitman, Jim (2006). Combinatorial Stochastic Processes. 1875. Berlin: Springer-Verlag. ISBN 9783540309901. http://works.bepress.com/jim_pitman/1/. Retrieved 2011-05-11. 
  7. "Dirichlet Process and Dirichlet Distribution -- Polya Restaurant Scheme and Chinese Restaurant Process". http://topicmodels.west.uni-koblenz.de/ckling/tmt/crp.html?parameters=0.5&dp=1#. 
  8. Xinhua Zhang, "A Very Gentle Note on the Construction of Dirichlet Process", September 2008, The Australian National University, Canberra. Online: http://users.cecs.anu.edu.au/~xzhang/pubDoc/notes/dirichlet_process.pdf
  9. Griffiths, T.L. and Ghahramani, Z. (2005) Infinite Latent Feature Models and the Indian Buffet Process . Gatsby Unit Technical Report GCNU-TR-2005-001.
  10. Qin, Zhaohui S (2006). "Clustering microarray gene expression data using weighted Chinese restaurant process". Bioinformatics 22 (16): 1988–1997. doi:10.1093/bioinformatics/btl284. PMID 16766561. 
  11. White, J. T.; Ghosal, S. (2011). "Bayesian smoothing of photon-limited images with applications in astronomy". Journal of the Royal Statistical Society, Series B (Statistical Methodology) 73 (4): 579–599. doi:10.1111/j.1467-9868.2011.00776.x. http://www4.stat.ncsu.edu/%7Eghoshal/papers/Denoising%20Method.pdf. 
  12. Li, M.; Ghosal, S. (2014). "Bayesian multiscale smoothing of Gaussian noised images". Bayesian Analysis 9 (3): 733–758. doi:10.1214/14-ba871. http://projecteuclid.org/download/pdfview_1/euclid.ba/1409921112. 

External links