Help in k means clustering

조회 수: 1 (최근 30일)
Mahesh
Mahesh 2014년 9월 30일
답변: Mahesh 2014년 9월 30일
Dear all, I am still not comfortable with k-means clustering in classification. Especially while rerunning with the code
eva = evalclusters(params,'kmeans','silhouette','KList',[2:20]);
It gives me different cases. Also while using separate code like
[idx,cent,sumdist, meansilh] =kcluster('param2W_sac.cld', optkn, s);
there is different answers. I think I am concemptually wrong in using rng-function. Is there some one to help me in this manner. It will be great is there availability to have online tutor in such cases.

채택된 답변

the cyclist
the cyclist 2014년 9월 30일
There is a randomness component in k-means clustering, as you surmise.
Have you tried putting the statement
rng(1)
at the beginning of your code? This will set the generator seed, and therefore produce the same series of pseudorandom numbers each time you run it.

추가 답변 (1개)

Mahesh
Mahesh 2014년 9월 30일
Thanks for reply. However I got following error message while trying with ring(1). I could not understand what it asks for. Moreover, I am using Matlab R2013b.
Error using rng (line 96) The current random number generator is the legacy generator. This is because you have executed a command such as rand('state',0), which activates MATLAB's legacy random number behavior. You may not use RNG to reseed the legacy random number generator.
Use rng('default') to reinitialize the random number generator to its startup configuration, or call RNG using a specific generator type, such as rng(seed,'twister').
Error in Cluster_runoff (line 12) s = rng(1);
Thanks for response again.

카테고리

Help CenterFile Exchange에서 Cluster Analysis and Anomaly Detection에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by