gmm_mt

所属分类:matlab编程
开发工具:matlab
文件大小:18KB
下载次数:4
上传日期:2014-09-05 13:06:16
上 传 者tariq
说明:  fficient GMM clustering using Multiple Threads

文件列表:
gmm_mt\gmm_cluster_mt.cpp (2334, 2013-12-27)
gmm_mt\gmm_dia_unix.h (6276, 2014-02-26)
gmm_mt\gmm_dia_win.h (7207, 2014-02-25)
gmm_mt\gmm_fit_mt.cpp (3508, 2014-05-07)
gmm_mt\gmm_mt.cpp (2904, 2014-02-26)
gmm_mt\gmm_unix.h (11986, 2014-02-26)
gmm_mt\gmm_win.h (12168, 2014-02-26)
gmm_mt\newdelete.cpp (756, 2009-06-05)
gmm_mt\newdelete.h (487, 2009-06-05)
license.txt (1310, 2014-09-04)

Efficient GMM clustering using Multiple Threads ------------------------------- by Haw-Shiuan Chang ------------------------------- contact samkendi@hotmail.com if you have any question about this code ------------------------------- Last updated date: 2014/9/4 ------------------------------- About: This code implements the basic GMM algorithm and support multiple covariance matrices with full values or only diagonal non-zero values, and its computation speed is optimized using C/C++ and multiple threads. When the number of samples and feature dimensions are large, this code would be significantly faster than the one in the Matlab toolbox For example, for data with 17 dimensions and 76800 samples, the following is the speeds of different codes to generate the same result after 100 iterations in a PC with 3.4GHz i7 Intel CPU: Matlab toolbox: 121.66 sec This code: 23.50 sec For research purposes, using or modifying our soure code is granted, but any form of commercial usage is not allowed. This code is originally written for the building visual words in following publication: Haw-Shiuan Chang and Yu-Chiang Frank Wang, "Simple-to-Complex Discriminative Clustering for Hierarchical Image Segmentation", ACCV 2014 If you use this code and your research is related to ours, you can consider to cite our paper. ------------------------------- Compilation: You first need to compile this code, execute following commands after mex is setted: mex gmm_mt.cpp newdelete.cpp mex gmm_fit_mt.cpp newdelete.cpp mex gmm_cluster_mt.cpp newdelete.cpp ------------------------------- Usage: If you want to perform GMM clustering, execute following command to run this code: P = gmm_mt(X,K,IDX,GMM_regulize,GMM_terminal_cond,max_iter,0); where "X" is the data, "K" is the number of clusters, "IDX" is the initial clustering results, "GMM_regulize" is the small number added to the diagonal values of variance matrix to prevent singularity,, "max_iter" is the maximal iteration number of EM algorithm, and the final input argument indicates the types of covariance matrix (0 means full values, 1 means only diagonal values, 2 means full values but using results of diagonal values as initialization) The output "P" is a matrix indicating the probability of every sample belonging to every cluster. If you can use Matlab statistics toolbox, the command would output the same result as: opts = statset('Display','iter','TolFun',GMM_terminal_cond,'MaxIter',max_iter); obj = gmdistribution.fit(X,K,'Start',IDX,'CovType','full','Options',opts,'Regularize',GMM_regulize); [~,~,P]=cluster(obj,X); The detail formats and meaning of "X", "IDX", "GMM_regulize", "GMM_terminal_cond", "P" are the same as the ones in Matlab toolbox. You can find them in http://www.mathworks.com/help/stats/gmdistribution.fit.html and http://www.mathworks.com/help/stats/gmdistribution.cluster.html ------------------------------- Note 1: If you want to fit a GMM model using one dataset ("X1") and clustering samples in another dataset (X2), you can use the following commands: obj = gmm_fit_mt(X1,K,IDX,GMM_regulize,GMM_terminal_cond,max_iter); P=gmm_cluster_mt(X2,obj); Notice that this code only provides covariance matrix with full values in this situation for now. ------------------------------- Note 2: There are various methods to perform initialization for GMM. Among them, I recommend to use kmeans to generate the initial clustering results, and you can download my efficient kmeans implementation here: http://www.mathworks.com/matlabcentral/fileexchange/47737-kmeans-mt The following is an example to perform GMM clustering (using my kmeans implmentation as initialization) if K clusters are needed: sample_num=size(X,1); init_k_centers=X(round(1:sample_num/K:sample_num),:); IDX=kmeans_mt(X,init_k_centers,max_iter,1); P = gmm_mt(X,K,IDX,GMM_regulize,GMM_terminal_cond,max_iter,0); ------------------------------- Acknowledgement: This code (especially the matrix inversion part) refers to the C++ code released by Florent D'halluin and Sylvain Calinon (2008 , LASA Lab, EPFL, CH-1015 Lausanne, Switzerland).

近期下载者

相关文件


收藏者