{"id":359,"date":"2013-12-06T15:04:53","date_gmt":"2013-12-06T20:04:53","guid":{"rendered":"http:\/\/homepages.uc.edu\/~yaozo\/wordpress\/?p=359"},"modified":"2013-12-06T15:04:53","modified_gmt":"2013-12-06T20:04:53","slug":"fuzzy-c-means-clustering","status":"publish","type":"post","link":"https:\/\/zhuoyao.net\/index.php\/2013\/12\/06\/fuzzy-c-means-clustering\/","title":{"rendered":"Fuzzy C-Means Clustering"},"content":{"rendered":"<p align=\"justify\"><span style=\"font-family: Arial, Helvetica, sans-serif; font-size: xx-small;\"><em>The Algorithm<\/em><\/span><span style=\"font-family: 'Times New Roman', Times, serif;\"><br \/>\nFuzzy c-means (FCM) is a method of clustering which allows one piece of data to belong to two or more clusters. This method (developed by\u00a0<a href=\"http:\/\/home.deib.polimi.it\/matteucc\/Clustering\/tutorial_html\/cmeans.html#dunn\">Dunn in 1973<\/a>\u00a0and improved by\u00a0<a href=\"http:\/\/home.deib.polimi.it\/matteucc\/Clustering\/tutorial_html\/cmeans.html#bezdek\">Bezdek in 1981<\/a>) is frequently used in pattern recognition. It is based on minimization of the following objective function:<\/span><\/p>\n<p align=\"center\"><img decoding=\"async\" alt=\"\" src=\"http:\/\/home.deib.polimi.it\/matteucc\/Clustering\/tutorial_html\/images\/image019.gif\" align=\"absmiddle\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0,\u00a0\u00a0\u00a0\u00a0\u00a0<img decoding=\"async\" alt=\"\" src=\"http:\/\/home.deib.polimi.it\/matteucc\/Clustering\/tutorial_html\/images\/image021.gif\" align=\"absmiddle\" \/><\/p>\n<p align=\"justify\"><span style=\"font-family: 'Times New Roman', Times, serif;\">where\u00a0<em>m<\/em>\u00a0is any real number greater than 1,\u00a0<em>u<sub>ij<\/sub><\/em>\u00a0is the degree of membership of\u00a0<em>x<sub>i<\/sub><\/em>\u00a0in the cluster\u00a0<em>j<\/em>,\u00a0<em>x<sub>i<\/sub><\/em>\u00a0is the\u00a0<em>i<\/em>th of d-dimensional measured data,\u00a0<em>c<sub>j<\/sub><\/em>\u00a0is the d-dimension center of the cluster, and ||*|| is any norm expressing the similarity between any measured data and the center.<br \/>\n<\/span><span style=\"font-family: 'Times New Roman', Times, serif;\">Fuzzy partitioning is carried out through an iterative optimization of the objective function shown above, with the update of membership\u00a0<em>u<sub>ij<\/sub><\/em>\u00a0and the cluster centers\u00a0<em>c<sub>j<\/sub><\/em>\u00a0by:<\/span><\/p>\n<p align=\"center\"><img decoding=\"async\" alt=\"\" src=\"http:\/\/home.deib.polimi.it\/matteucc\/Clustering\/tutorial_html\/images\/image023.gif\" align=\"absmiddle\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0,\u00a0\u00a0\u00a0\u00a0\u00a0<img decoding=\"async\" alt=\"\" src=\"http:\/\/home.deib.polimi.it\/matteucc\/Clustering\/tutorial_html\/images\/image025.gif\" align=\"texttop\" \/><\/p>\n<p align=\"justify\"><span style=\"font-family: 'Times New Roman', Times, serif;\">This iteration will stop when\u00a0<img decoding=\"async\" alt=\"\" src=\"http:\/\/home.deib.polimi.it\/matteucc\/Clustering\/tutorial_html\/images\/image027.gif\" align=\"absmiddle\" \/>, where\u00a0<img decoding=\"async\" alt=\"\" src=\"http:\/\/home.deib.polimi.it\/matteucc\/Clustering\/tutorial_html\/images\/image002.gif\" align=\"absmiddle\" \/>\u00a0is a termination criterion between 0 and 1, whereas\u00a0<em>k<\/em>\u00a0are the iteration steps. This procedure converges to a local minimum or a saddle point of<em>J<sub>m<\/sub><\/em>.<br \/>\n<\/span><span style=\"font-family: 'Times New Roman', Times, serif;\">The algorithm is composed of the following steps:<\/span><\/p>\n<table width=\"75%\" border=\"1\" align=\"center\">\n<tbody>\n<tr>\n<td>\n<ol>\n<li><span style=\"font-family: 'Times New Roman', Times, serif;\"><em>Initialize U=[u<sub>ij<\/sub>] matrix, U<sup>(0)<br \/>\n<\/sup><\/em><\/span><\/li>\n<li><em><span style=\"font-family: 'Times New Roman', Times, serif;\">At k-step: calculate the centers vectors C<sup>(k)<\/sup>=[c<sub>j<\/sub>] with U<sup>(k)\n<p><\/sup><\/span><\/em><em><span style=\"font-family: 'Times New Roman', Times, serif;\"><img decoding=\"async\" alt=\"\" src=\"http:\/\/home.deib.polimi.it\/matteucc\/Clustering\/tutorial_html\/images\/image025.gif\" \/><br \/>\n<\/span><\/em><\/li>\n<li><em><span style=\"font-family: 'Times New Roman', Times, serif;\">Update U<sup>(k)<\/sup>\u00a0, U<sup>(k+1)\n<p><\/sup><\/span><\/em><em><span style=\"font-family: 'Times New Roman', Times, serif;\"><img decoding=\"async\" alt=\"\" src=\"http:\/\/home.deib.polimi.it\/matteucc\/Clustering\/tutorial_html\/images\/image023.gif\" \/><br \/>\n<\/span><\/em><\/li>\n<li><em><span style=\"font-family: 'Times New Roman', Times, serif;\">If || U<sup>(k+1)<\/sup>\u00a0&#8211; U<sup>(k)<\/sup>||&lt;<img decoding=\"async\" alt=\"\" src=\"http:\/\/home.deib.polimi.it\/matteucc\/Clustering\/tutorial_html\/images\/image002.gif\" \/>\u00a0then STOP; otherwise return to step 2.<\/span><\/em><\/li>\n<\/ol>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong><span style=\"font-family: 'Times New Roman', Times, serif;\">Remarks<\/span><\/strong><span style=\"font-family: 'Times New Roman', Times, serif;\"><br \/>\nAs already told, data are bound to each cluster by means of a Membership Function, which represents the fuzzy behaviour of this algorithm. To do that, we simply have to build an appropriate matrix named U whose factors are numbers between 0 and 1, and represent the degree of membership between data and centers of clusters.<br \/>\nFor a better understanding, we may consider this simple mono-dimensional example. Given a certain data set, suppose to represent it as distributed on an axis. The figure below shows this:<\/span><\/p>\n<p align=\"center\"><img decoding=\"async\" alt=\"\" src=\"http:\/\/home.deib.polimi.it\/matteucc\/Clustering\/tutorial_html\/images\/image031.gif\" \/><\/p>\n<p align=\"justify\"><span style=\"font-family: 'Times New Roman', Times, serif;\">Looking at the picture, we may identify two clusters in proximity of the two data concentrations. We will refer to them using \u2018A\u2019 and \u2018B\u2019. In the first approach shown in this tutorial &#8211; the k-means algorithm &#8211; we associated each datum to a specific centroid; therefore, this membership function looked like this:<\/span><\/p>\n<p align=\"center\"><img decoding=\"async\" alt=\"\" src=\"http:\/\/home.deib.polimi.it\/matteucc\/Clustering\/tutorial_html\/images\/image033.gif\" \/><\/p>\n<p align=\"justify\"><span style=\"font-family: 'Times New Roman', Times, serif;\">In the FCM approach, instead, the same given datum does not belong exclusively to a well defined cluster, but it can be placed in a middle way. In this case, the membership function follows a smoother line to indicate that every datum may belong to several clusters with different values of the membership coefficient.<\/span><\/p>\n<p align=\"center\"><img decoding=\"async\" alt=\"\" src=\"http:\/\/home.deib.polimi.it\/matteucc\/Clustering\/tutorial_html\/images\/image035.gif\" \/><\/p>\n<p align=\"justify\"><span style=\"font-family: 'Times New Roman', Times, serif;\">In the figure above, the datum shown as a red marked spot belongs more to the B cluster rather than the A cluster. The value 0.2 of \u2018m\u2019 indicates the degree of membership to A for such datum. Now, instead of using a graphical representation, we introduce a matrix U whose factors are the ones taken from the membership functions:<\/span><\/p>\n<p align=\"center\"><span style=\"font-family: 'Times New Roman', Times, serif;\"><img decoding=\"async\" alt=\"\" src=\"http:\/\/home.deib.polimi.it\/matteucc\/Clustering\/tutorial_html\/images\/image037.gif\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<img decoding=\"async\" alt=\"\" src=\"http:\/\/home.deib.polimi.it\/matteucc\/Clustering\/tutorial_html\/images\/image039.gif\" \/><\/span><\/p>\n<p align=\"center\"><span style=\"font-family: 'Times New Roman', Times, serif;\">(a)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0(b)<\/span><\/p>\n<p align=\"justify\"><span style=\"font-family: 'Times New Roman', Times, serif;\">The number of rows and columns depends on how many data and clusters we are considering. More exactly we have C = 2 columns (C = 2 clusters) and N rows, where C is the total number of clusters and N is the total number of data. The generic element is so indicated:\u00a0<em>u<sub>ij<\/sub><\/em>.<br \/>\nIn the examples above we have considered the k-means (a) and FCM (b) cases. We can notice that in the first case (a) the coefficients are always unitary. It is so to indicate the fact that each datum can belong only to one cluster. Other properties are shown below:<\/span><\/p>\n<ul>\n<li><img decoding=\"async\" alt=\"\" src=\"http:\/\/home.deib.polimi.it\/matteucc\/Clustering\/tutorial_html\/images\/image041.gif\" align=\"absmiddle\" \/><\/li>\n<li><img decoding=\"async\" alt=\"\" src=\"http:\/\/home.deib.polimi.it\/matteucc\/Clustering\/tutorial_html\/images\/image043.gif\" align=\"absmiddle\" \/><\/li>\n<li><img decoding=\"async\" alt=\"\" src=\"http:\/\/home.deib.polimi.it\/matteucc\/Clustering\/tutorial_html\/images\/image045.gif\" align=\"absmiddle\" \/><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p align=\"justify\"><em><span style=\"font-family: Arial, Helvetica, sans-serif; font-size: xx-small;\">An Example<\/span><\/em><span style=\"font-family: 'Times New Roman', Times, serif;\"><br \/>\nHere, we consider the simple case of a mono-dimensional application of the FCM. Twenty data and three clusters are used to initialize the algorithm and to compute the U matrix. Figures below (taken from our\u00a0<a href=\"http:\/\/home.deib.polimi.it\/matteucc\/Clustering\/tutorial_html\/AppletFCM.html\">interactive demo<\/a>) show the membership value for each datum and for each cluster. The color of the data is that of the nearest cluster according to the membership function.<\/span><\/p>\n<p align=\"center\"><img decoding=\"async\" alt=\"\" src=\"http:\/\/home.deib.polimi.it\/matteucc\/Clustering\/tutorial_html\/images\/image046.jpg\" \/><\/p>\n<p align=\"justify\"><span style=\"font-family: 'Times New Roman', Times, serif;\">In the simulation shown in the figure above we have used a fuzzyness coefficient m = 2 and we have also imposed to terminate the algorithm when\u00a0<img decoding=\"async\" alt=\"\" src=\"http:\/\/home.deib.polimi.it\/matteucc\/Clustering\/tutorial_html\/images\/image048.gif\" align=\"absmiddle\" \/>. The picture shows the initial condition where the fuzzy distribution depends on the particular position of the clusters. No step is performed yet so that clusters are not identified very well. Now we can run the algorithm until the stop condition is verified. The figure below shows the final condition reached at the 8th step with m=2 and\u00a0<img decoding=\"async\" alt=\"\" src=\"http:\/\/home.deib.polimi.it\/matteucc\/Clustering\/tutorial_html\/images\/image002.gif\" align=\"absmiddle\" \/>=0.3:<\/span><\/p>\n<p align=\"center\"><img decoding=\"async\" alt=\"\" src=\"http:\/\/home.deib.polimi.it\/matteucc\/Clustering\/tutorial_html\/images\/image049.jpg\" \/><\/p>\n<p align=\"justify\"><span style=\"font-family: 'Times New Roman', Times, serif;\">Is it possible to do better? Certainly, we could use an higher accuracy but we would have also to pay for a bigger computational effort. In the next figure we can see a better result having used the same initial conditions and\u00a0<img decoding=\"async\" alt=\"\" src=\"http:\/\/home.deib.polimi.it\/matteucc\/Clustering\/tutorial_html\/images\/image002.gif\" align=\"absmiddle\" \/>=0.01, but we needed 37 steps!<\/span><\/p>\n<p align=\"center\"><img decoding=\"async\" alt=\"\" src=\"http:\/\/home.deib.polimi.it\/matteucc\/Clustering\/tutorial_html\/images\/image051.jpg\" \/><\/p>\n<p><span style=\"font-family: 'Times New Roman', Times, serif;\">It is also important to notice that different initializations cause different evolutions of the algorithm. In fact it could converge to the same result but probably with a different number of iteration steps.<\/span><\/p>\n<p align=\"justify\"><span style=\"font-family: Arial, Helvetica, sans-serif; font-size: xx-small;\"><em>Bibliography<\/em><\/span><\/p>\n<ul>\n<li>\n<div align=\"justify\"><span style=\"font-family: 'Times New Roman', Times, serif;\"><a name=\"dunn\"><\/a>J. C. Dunn (1973): &#8220;A Fuzzy Relative of the ISODATA Process and Its Use in Detecting Compact Well-Separated Clusters&#8221;,\u00a0<em>Journal of Cybernetics<\/em>\u00a03: 32-57<\/span><\/div>\n<\/li>\n<li>\n<div align=\"justify\"><span style=\"font-family: 'Times New Roman', Times, serif;\"><a name=\"bezdek\"><\/a>J. C. Bezdek (1981): &#8220;Pattern Recognition with Fuzzy Objective Function Algoritms&#8221;, Plenum Press, New York<\/span><\/div>\n<\/li>\n<li>\n<div align=\"justify\"><span style=\"font-family: 'Times New Roman', Times, serif;\">Tariq Rashid: \u201cClustering\u201d<br \/>\n<a href=\"http:\/\/www.cs.bris.ac.uk\/home\/tr1690\/documentation\/fuzzy_clustering_initial_report\/node11.html\">http:\/\/www.cs.bris.ac.uk\/home\/tr1690\/documentation\/fuzzy_clustering_initial_report\/node11.html<\/a><\/span><\/div>\n<\/li>\n<li>\n<div align=\"justify\"><span style=\"font-family: 'Times New Roman', Times, serif;\">Hans-Joachim Mucha and Hizir Sofyan: \u201cNonhierarchical Clustering\u201d<br \/>\n<a href=\"http:\/\/www.quantlet.com\/mdstat\/scripts\/xag\/html\/xaghtmlframe149.html\">http:\/\/www.quantlet.com\/mdstat\/scripts\/xag\/html\/xaghtmlframe149.html<\/a><\/span><\/div>\n<p>&nbsp;<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>The Algorithm Fuzzy c-means (FCM) is a method of clustering which allows one piece of data to belong to two or more clusters. This method&hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-359","post","type-post","status-publish","format-standard","hentry","category-image-processing"],"_links":{"self":[{"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/posts\/359","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/comments?post=359"}],"version-history":[{"count":0,"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/posts\/359\/revisions"}],"wp:attachment":[{"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/media?parent=359"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/categories?post=359"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/tags?post=359"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}