Tell me more ×
Cross Validated is a question and answer site for statisticians, data analysts, data miners and data visualization experts. It's 100% free, no registration required.

I recently read a fascinating article describing methods for clustering data without assuming a fixed number of clusters.

The article even includes some sample code, in a mix of Ruby, Python, and R. However, the meat of the analysis is performed using scikit-learn's Dirichlet Process Gaussian Mixture Model to actually find clusters in some sample data taken from McDonald's menu.

Obviously, this a a great excuse to learn some more python, but I'm lazy and would like to find a ready-made R package that can take a dataframe and return clusters, in a manner similar to the kmeans function. A quick search on CRAN reveals the packages dpmixsim and profdpm. Any suggestions for the best place to start?

share|improve this question
Also cran.r-project.org/web/packages/DPpackage which has Dirichlet process clustering I think, and cran.r-project.org/web/packages/bayesm has some DP stuff, don't remember what. – scellus May 16 '12 at 16:11
Whoever voted down- could you please leave a comment? – Zach May 16 '12 at 17:07
I am not the one who downvoted but I wanted to comment that one can simply add the number of clusters to the likelihood of the mixture distribution (often solved using E-M algorithm). It appears from your problem a Gaussian mixture model is assumed ( I don't know how the Dirichlet process fits in). There are some excellent books on mixture distributions. I recommend two by McLachlan. Finite Mixture Models (Wiley Series in Probability and Statistics) [Hardcover] Geoffrey McLachlan (Author), David Peel (Author) and – Michael Chernick May 16 '12 at 17:46
Mixture Models (Statistics: A Series of Textbooks and Monographs) [Hardcover] G. J. McLachlan (Author), K. E. Basford (Author) – Michael Chernick May 16 '12 at 17:47
1  
@Michael: maximum likelihood with a varying number of (gaussien) clusters — how do you make it not to overlearn, especially if the cluster width is a parameters as well? – scellus May 16 '12 at 18:17

1 Answer

up vote 2 down vote accepted

I looked at this more carefully, and the package bayesm has rDPGibbs which does "Density Estimation with Dirichlet Process Prior and Normal Base", a kind of Dirichlet clustering. DPpackage has DPdensity which looks similar. I haven't tried these packages myself, so I have no idea how well they work in practice. Details such as parameterization of the normal base and the possibility to set hyperpriors for the DP parameter may be significant.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.