Question: I am trying to implement and learn a Dirichlet Process to cluster my data (or as machine learning people speak, estimate the density). 

I read a lot of paper in the topic and sort of got the idea. But I am still confused; here are a series of question,

1) What is the different between Chinese Restaurant Model and DP ?
2) What is the different between Infinite Mixture Models and DP ?

To fully understand everything, I have implemented Chinese Restaurant Model, Polya Urn model and Stick-breaking; But it seems, implementing DP from scratch is a hard thing to do ! I can read and write python, R, Matlab. 

1) Is there any code you recommend to read and improve to fully understand/work/develop DP ? 
2) Based on my research, codes, for Dirichlet Process were not easy to read ! really long, lengthy (probably since the efficiency were more important that clarity).
3) However, there is more code on Infinite Mixture Model than Dirichlet Process. If these two methods are not far from each other can I use IMM ?! Basically, I want to build up my new model, and I don't want to re-invent a wheel.

I appreciate your comments

* UPDATE
since a lot of people have recommended Edwin Chen's tutorial on ["Infinite Mixture Model with Non-parametric Bayes and the DP"](http://blog.echen.me/2012/03/20/infinite-mixture-models-with-nonparametric-bayes-and-the-dirichlet-process/); 
This tutorial has a misleading title; It only covers various representation of DP, specificity, CPR, stick-breaking, Polya-Urn Model; and at the end he is using a Mixture Model from scikit and make a couple of histogram on each cluster;

Answer: 
**1) What is the different between Chinese Restaurant Model and DP?**

None. CRP is a particular representation of DP. Depending on your problem you might want to use one representation over another (CRP, Stick-breaking, etc).

**2) What is the different between Infinite Mixture Models and DP?**

DP is just used as a prior for the Infinite Mixture Model. This is why Infinite Gaussian Mixture Models are also called DP-GMM. Actually the first paper on the subject is ["The Infinite Gaussian Mixture Model" (Rasmussen, 1999)](https://www.seas.harvard.edu/courses/cs281/papers/rasmussen-1999a.pdf)

**3) Implementations**

I am actually trying to implement Rasmussen's paper for a multivariate case in Python. (he uses Gibbs sampling, which is simpler than Variational Inference approximations). In the meanwhile, I found:

* A very nice post by Edwin Chen: [Infinite Mixture Models with Nonparametric Bayes and the Dirichlet Process](http://blog.echen.me/2012/03/20/infinite-mixture-models-with-nonparametric-bayes-and-the-dirichlet-process/)
* An introduction to IGMM by Frank Wood/ [Gentle Introduction to
Infinite Gaussian Mixture Modeling](http://www.robots.ox.ac.uk/~fwood/talks/Wood-IGMM-Intro-2006.pdf)
* An attempt to implement the IGMM by Michael Mander: [Implementing the Infinite GMM](http://mr-pc.org/work/cs4771igmm.pdf). He reports some troubles within the multivariate case. But this was in 2005. I'm not sure whether it is already outdated and his troubles solved in Chen's post or in a more recent Rasmussen's paper [Dirichlet Process Gaussian Mixture Models: Choice of the Base
Distribution](http://www.ics.uci.edu/~dgorur/papers/GorurRasmussen_DPGMM.pdf) (I am currently looking at these.)
A very understandable code by Jacob Eisenstein is available for Matlab at <https://github.com/jacobeisenstein/DPMM>. It is based on the Dissertation "Graphical Models for Visual Object Recognition and Tracking" by E.B. Sudderth.