Marginalizing over a Chinese Restaurant Process prior I am reading a paper by Kemp et al. and there is a part about marginalising over a Chinese Restaurant Process and I am quite clueless about how could one marginalise over such a prior! The details of the model can also be seen in the following lines of the paper:


According to Wiki the CRP has the following probability over the partitions:
$$\Pr(B_n = B) = \dfrac{\prod_{b\in B} (|b| -1)!}{n!}$$
Should I consider that this is the prior and consider that in the marginalising any $P(y|z)$ where $z$ has more elements than number of observations is zero in marginalising?
 A: I just read the Appendix, but I would say that:


*

*Forget about this formula you found in Wikipedia. You want to access to $p(\mathbf{z})$ by using $p(z_i)$, which has the classic form Kemp provided in the Appendix (the one that says that the probability of sitting in a existing table is proportional to the number of people in the table, and the probability of opening a new table is proportional to $\gamma$ (by the way, usually denoted as $\alpha$)).

*If you need to take samples from $p(\mathbf{z})$, you sample from $z_1$, $z_2$.. one at a time. Every time you sample $z_i$ you consider the others have the values of their last samples.
Since know you know how to take $N$ samples from $p(\mathbf{z})$, and you know how to get, or how to sample from, $p(y | \mathbf{z})$, then you can multiply every pair of samples $p(y^{(s)} | \mathbf{z}^{(s)}) p(\mathbf{z}^{(s)})$ to get a new sample from the posterior $\mathbf{z}^{(s)} | y$.
And from this posterior, you can multiply each sample by $p(\theta^{(s)} | y^{(s)}, z^{(s)})$
I didn't get the notation $y'$ and why it does not depend on $z$, though. But I hope it gives you some intuition. The main idea is to do the integrals by using Monte Carlo.
So, the short answer to your question is: you don' really marginalize over a CRP, you sample from it and use these samples to compute the things that depend on $\mathbf{z}$. 
Even shorter:
$$
p(y) = \int p(y | z) p(z) \text{d}z \approx \frac{1}{N}\sum_{s=1}^Np(y |z^{(s)})
$$
