Silhouette plot and fuzzy c-means

조회 수: 4 (최근 30일)
med-sweng
med-sweng 2013년 12월 31일
댓글: Walter Roberson 2013년 12월 31일
I'm trying to use Silhouette plot with fuzzy c-means in a way similar to the example here.
The case is that my data is in the form of an image.
When I did the following:
I=imread('img.png');
[center,U,obj_fcn] = fcm(I, 2);
I got the following error:
Error using *
MTIMES is not fully supported for integer classes. At least one input
must be scalar.
To compute elementwise TIMES, use TIMES (.*) instead.
Error in stepfcm (line 25)
center = mf*data./((ones(size(data, 2), 1)*sum(mf'))'); % new center
Error in fcm (line 88)
[U, center, obj_fcn(i)] = stepfcm(data, U, cluster_n, expo);
Thanks.
EDIT
The example link is here: http://www.mathworks.com/help/stats/silhouette.html (create Silhouette plot)

답변 (1개)

Walter Roberson
Walter Roberson 2013년 12월 31일
[center,U,obj_fcn] = fcm(double(I), 2);
  댓글 수: 2
med-sweng
med-sweng 2013년 12월 31일
편집: Walter Roberson 2013년 12월 31일
I'm trying to follow the example here. http://www.mathworks.com/help/stats/silhouette.html (Create silhouette plot). This is why I showed the way I showed in my example.
But, when I use the way you have showed, are there any changes to do in order to plot the Silhouette?
Walter Roberson
Walter Roberson 2013년 12월 31일
The sample code you are looking at creates data using rand(), which generates floating point data. You created your data using imread(), which is going to result in some integer data type, typically uint8. fcm() is not designed to be able to operate on integer data types, so pass in the double precision equivalent of the integers by calling double() on the data as I showed.
You might have to pass double(I) into silhouette() but you could try it.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Data Clustering에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by