Rank: 110492 based on 0 downloads (last 30 days) and 0 file submitted
photo

Brian

E-mail

Personal Profile:
Professional Interests:

 

Watch this Author's files

 

Comments and Ratings by Brian View all
Updated File Comments Rating
04 May 2011 EM algorithm for Gaussian mixture model EM algorithm for Gaussian mixture. Works on arbitray dimensions with high speed and precision. Author: Mo Chen

Found this pointless piece of code in the initialization:

while k ~= unique(label)
idx = randsample(n,k);
m = X(:,idx);
[~,label] = max(bsxfun(@minus,m'*X,sum(m.^2,1)'/2),[],1);
end

Unless I am missing something, I'm assuming you were trying to make sure at least one point is assigned to each cluster? Well, this just checks if at least 1 point is assigned to the kth cluster. E.g. try:
k=5;
if k ~= unique([5;5;5;5])
disp('Bad!');
else
disp('OK');
end
it will say that label assignment is OK.

Furthermore since you draw the centers from the points themselves, there will always be at least 1 point in each cluster, making even the intended code pointless.

You may want to use another strategy to ensure centers are chosen that take more than a single point for instance.

Another common initialization strategy is to partition the points randomly into k clusters.

24 Jul 2009 Hessian based Frangi Vesselness filter Enhancement of Vessel/ridge like structures in 2D/3D image using hessian eigen values Author: Dirk-Jan Kroon

Jichao,

I ran across your post since I was looking how to solve the same problem for another file. I found out it was because the compiler could not handle the new C99 comments of the form "//", changing them to the original C comment style of "/*" and "*/" fixed my problem. I found this info (with more details) here:
http://www.mathworks.nl/matlabcentral/newsreader/view_thread/169199

Contact us