Info
Cette question est clôturée. Rouvrir pour modifier ou répondre.
Clustering: Error for “Losing” its Member During Initial, Possible?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I'm working with k-means in MATLAB GUI. I have done with it. The program (GUI) works quite fine (in command window, it works perfectly). I don't know, sometimes the GUI is working, but sometimes the error appears suddenly. Here is the error message:
??? Error while evaluating uicontrol Callback
??? Error using ==> kmeans>batchUpdate at 436
Empty cluster created at iteration 1.
Error in ==> kmeans at 337
converged = batchUpdate();
Error in ==> CalcRand at 4
[g c] = kmeans(data,k,'dist','SqEuclidean');
Error in ==> kmeansFIN2>Centroid_Callback at 203
[g,c,y,clr]=CalcRand( data,k );
Error in ==> gui_mainfcn at 96
feval(varargin{:});
Error in ==> kmeansFIN2 at 42
gui_mainfcn(gui_State, varargin{:});
Error in ==>
@(hObject,eventdata)kmeansFIN2('Centroid_Callback',hObject,eventdata,guidata(hObject))
??? Error while evaluating uicontrol Callback
A little explanation: My GUI has 4 push buttons, they are Cluster, Show Centroid, Show the Graphic, Evaluate the Graphic. I could give my code here, but it is too long, so I just give a hint of my codes:
% CLUSTER (PUSH BUTTON)
[g c] = kmeans(cobat,k,'dist','SqEuclidean');
y = [cobat g]
% SHOW CENTROID (PUSH BUTTON)
c
% EVALUATE THE CLUSTER (PUSH BUTTON)
[s,h]=silhouette(cobat,g,'SqEuclidean');
% SHOW THE GRAPHIC (PUSH BUTTON)
%# show points and clusters (color-coded)
clr = lines(k);
figure, hold on
scatter3(cobat(:,1), cobat(:,2), cobat(:,3), 36, clr(g,:), 'Marker','.')
scatter3(c(:,1), c(:,2), c(:,3), 100, clr, 'Marker','o', 'LineWidth',3)
hold off
view(3), axis vis3d, box on, rotate3d on
xlabel('x'), ylabel('y'), zlabel('z')
According to the error, someone said that, "It is possible for a cluster to "lose" all of its members during the initial phase of clustering; that's just how the K-Means algorithm works. The usual reason why this happens is a bad choice of starting cluster centroids. The 'EmptyAction' parameter controls what steps are taken if it does happen, and the default is to error out." Is it right? Can someone explain me with trusted sources? And is there way to stay away from this error?
0 commentaires
Réponses (0)
Cette question est clôturée.
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!