Rank: 379 based on 308 downloads (last 30 days) and 3 files submitted
photo

Michael Chen

E-mail

Personal Profile:

Professional Interests:

 

Watch this Author's files

 

Files Posted by Michael View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
07 Nov 2009 Discrete (multinomial) distribution sampler Random number generator of a discrete (multinomial) distribution Author: Michael Chen discrete multinomial ... 54 0
03 Jul 2009 Pairwise Euclidean distances Fully vectorized function to compute square Euclidean or Mahalanobis distances between vectors. Author: Michael Chen pairwise, distance, euclidean, mahalanobis 57 8
  • 3.0
3.0 | 3 ratings
01 Jul 2009 Screenshot kmeans clustering Fully vectorized kmeans algorithm. Fast yet simple (10 lines) Author: Michael Chen kmeans code for image..., kmeans, vector quantization, clustering 197 7
  • 4.5
4.5 | 3 ratings
Comments and Ratings by Michael View all
Updated File Comments Rating
05 Nov 2009 Sampling from a discrete distribution The function is to draw samples from an arbitrary discrete distribution. Author: Dahua Lin

your function seems to complicate the problem a little bit.
The following line is enough to do the jod
[~,x] = histc(rand(1,n),[0;cumsum(p(:))/sum(p)]);

16 Oct 2009 kmeans clustering Fully vectorized kmeans algorithm. Fast yet simple (10 lines) Author: Michael Chen

The results of kmeans algorithm can be different with different initializations. Actually the kmeans function in matlab is not a standard kmeans algorithm. It tries to get smaller energy by switching data points in different clusters after the standard kmeans procedure converged.
One purpose of the litekmeans is to be simple (only 10 lines of code), therefore I did not add extra code to handle empty cluster. It just discard the cluster if the cluster becomes empty. You can modify the code yourself if you want extra functionality.

08 Oct 2009 kmeans clustering Fully vectorized kmeans algorithm. Fast yet simple (10 lines) Author: Michael Chen

Yes, just call the litekmeans.m to get the clustering results. You cannot get a visualization in a simple way for the data whose dimensions are more than 3. The scatterd.m can only handle data of 2d or 3d.

10 Aug 2009 kmeans clustering Fully vectorized kmeans algorithm. Fast yet simple (10 lines) Author: Michael Chen

To Sven:
Sorry for the inconvenience. Here's the answer to your questions.
The function takes two parameters. The first one is a d x n data matrix, of which each column is assumed to be a sample vector of d dimension. The second parameter is the number of clusters. The output is a 1 x n vector, of which each element is the label of the corresponding input sample vector.
The function handles data of arbitrary dimensions.

03 Jul 2009 Pairwise Euclidean distances Fully vectorized function to compute square Euclidean or Mahalanobis distances between vectors. Author: Michael Chen

One more word for input verification, you can not check every aspects of the inputs. For example, checking whether the input matirx is positive definite in this code is just crazy which will cost more time than the function itself. One must end up at some point between checking everything and checking nothing, which is a design desicion the coder should make.
In such a simple code, i dont want nasty guarding code, which be even longer than the main funcional code, distracting the reader's attention.

Comments and Ratings on Michael's Files View all
Updated File Comment by Comments Rating
16 Oct 2009 kmeans clustering Fully vectorized kmeans algorithm. Fast yet simple (10 lines) Author: Michael Chen Chen, Michael

The results of kmeans algorithm can be different with different initializations. Actually the kmeans function in matlab is not a standard kmeans algorithm. It tries to get smaller energy by switching data points in different clusters after the standard kmeans procedure converged.
One purpose of the litekmeans is to be simple (only 10 lines of code), therefore I did not add extra code to handle empty cluster. It just discard the cluster if the cluster becomes empty. You can modify the code yourself if you want extra functionality.

13 Oct 2009 kmeans clustering Fully vectorized kmeans algorithm. Fast yet simple (10 lines) Author: Michael Chen Xie, Fen

this method produces empty clusters constantly, be careful dealing with these exceptions~

13 Oct 2009 kmeans clustering Fully vectorized kmeans algorithm. Fast yet simple (10 lines) Author: Michael Chen Xie, Fen

Sorry, I have compared the results of your program and the embedded program of matlab, the two results doesn't show the same, so what does it mean??

08 Oct 2009 kmeans clustering Fully vectorized kmeans algorithm. Fast yet simple (10 lines) Author: Michael Chen Chen, Michael

Yes, just call the litekmeans.m to get the clustering results. You cannot get a visualization in a simple way for the data whose dimensions are more than 3. The scatterd.m can only handle data of 2d or 3d.

05 Oct 2009 kmeans clustering Fully vectorized kmeans algorithm. Fast yet simple (10 lines) Author: Michael Chen Kalabak, Onur

Thank you for the share. I have two questions. Do we have to use both of the functions to cluster? I have 13x7000 matrix which I want to cluster. Should I just simply apply the matrice to litekmeans.m? And how can I plot the result as displayed in the picture?

Thanks

Top Tags Applied by Michael
clustering, discrete multinomial sampling random, distance, euclidean, kmeans
Files Tagged by Michael View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
07 Nov 2009 Discrete (multinomial) distribution sampler Random number generator of a discrete (multinomial) distribution Author: Michael Chen discrete multinomial ... 54 0
03 Jul 2009 Pairwise Euclidean distances Fully vectorized function to compute square Euclidean or Mahalanobis distances between vectors. Author: Michael Chen pairwise, distance, euclidean, mahalanobis 57 8
  • 3.0
3.0 | 3 ratings
01 Jul 2009 Screenshot kmeans clustering Fully vectorized kmeans algorithm. Fast yet simple (10 lines) Author: Michael Chen kmeans code for image..., kmeans, vector quantization, clustering 197 7
  • 4.5
4.5 | 3 ratings
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com