EVOLUTION-MANAGER
Edit File: cmeans.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Fuzzy C-Means Clustering</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for cmeans {e1071}"><tr><td>cmeans {e1071}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Fuzzy C-Means Clustering</h2> <h3>Description</h3> <p>The fuzzy version of the known <em>k</em>means clustering algorithm as well as an on-line variant (Unsupervised Fuzzy Competitive learning). </p> <h3>Usage</h3> <pre> cmeans(x, centers, iter.max = 100, verbose = FALSE, dist = "euclidean", method = "cmeans", m = 2, rate.par = NULL, weights = 1, control = list()) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>The data matrix where columns correspond to variables and rows to observations.</p> </td></tr> <tr valign="top"><td><code>centers</code></td> <td> <p>Number of clusters or initial values for cluster centers.</p> </td></tr> <tr valign="top"><td><code>iter.max</code></td> <td> <p>Maximum number of iterations.</p> </td></tr> <tr valign="top"><td><code>verbose</code></td> <td> <p>If <code>TRUE</code>, make some output during learning.</p> </td></tr> <tr valign="top"><td><code>dist</code></td> <td> <p>Must be one of the following: If <code>"euclidean"</code>, the mean square error, if <code>"manhattan"</code>, the mean absolute error is computed. Abbreviations are also accepted.</p> </td></tr> <tr valign="top"><td><code>method</code></td> <td> <p>If <code>"cmeans"</code>, then we have the <i>c</i>-means fuzzy clustering method, if <code>"ufcl"</code> we have the on-line update. Abbreviations are also accepted.</p> </td></tr> <tr valign="top"><td><code>m</code></td> <td> <p>A number greater than 1 giving the degree of fuzzification.</p> </td></tr> <tr valign="top"><td><code>rate.par</code></td> <td> <p>A number between 0 and 1 giving the parameter of the learning rate for the on-line variant. The default corresponds to <i>0.3</i>.</p> </td></tr> <tr valign="top"><td><code>weights</code></td> <td> <p>a numeric vector with non-negative case weights. Recycled to the number of observations in <code>x</code> if necessary.</p> </td></tr> <tr valign="top"><td><code>control</code></td> <td> <p>a list of control parameters. See <b>Details</b>.</p> </td></tr> </table> <h3>Details</h3> <p>The data given by <code>x</code> is clustered by generalized versions of the fuzzy <em>c</em>-means algorithm, which use either a fixed-point or an on-line heuristic for minimizing the objective function </p> <p style="text-align: center;"><i>∑_i ∑_j w_i u_{ij}^m d_{ij},</i></p> <p>where <i>w_i</i> is the weight of observation <i>i</i>, <i>u_{ij}</i> is the membership of observation <i>i</i> in cluster <i>j</i>, and <i>d_{ij}</i> is the distance (dissimilarity) between observation <i>i</i> and center <i>j</i>. The dissimilarities used are the sums of squares (<code>"euclidean"</code>) or absolute values (<code>"manhattan"</code>) of the element-wise differences. </p> <p>If <code>centers</code> is a matrix, its rows are taken as the initial cluster centers. If <code>centers</code> is an integer, <code>centers</code> rows of <code>x</code> are randomly chosen as initial values. </p> <p>The algorithm stops when the maximum number of iterations (given by <code>iter.max</code>) is reached, or when the algorithm is unable to reduce the current value <code>val</code> of the objective function by <code>reltol * (abs(val) * reltol)</code> at a step. The relative convergence tolerance <code>reltol</code> can be specified as the <code>reltol</code> component of the list of control parameters, and defaults to <code>sqrt(.Machine$double.eps)</code>. </p> <p>If <code>verbose</code> is <code>TRUE</code>, each iteration displays its number and the value of the objective function. </p> <p>If <code>method</code> is <code>"cmeans"</code>, then we have the <i>c</i>-means fuzzy clustering method, see for example Bezdek (1981). If <code>"ufcl"</code>, we have the On-line Update (Unsupervised Fuzzy Competitive Learning) method due to Chung and Lee (1992), see also Pal et al (1996). This method works by performing an update directly after each input signal (i.e., for each single observation). </p> <p>The parameters <code>m</code> defines the degree of fuzzification. It is defined for real values greater than 1 and the bigger it is the more fuzzy the membership values of the clustered data points are. </p> <h3>Value</h3> <p>An object of class <code>"fclust"</code> which is a list with components: </p> <table summary="R valueblock"> <tr valign="top"><td><code>centers</code></td> <td> <p>the final cluster centers.</p> </td></tr> <tr valign="top"><td><code>size</code></td> <td> <p>the number of data points in each cluster of the closest hard clustering.</p> </td></tr> <tr valign="top"><td><code>cluster</code></td> <td> <p>a vector of integers containing the indices of the clusters where the data points are assigned to for the closest hard clustering, as obtained by assigning points to the (first) class with maximal membership.</p> </td></tr> <tr valign="top"><td><code>iter</code></td> <td> <p>the number of iterations performed.</p> </td></tr> <tr valign="top"><td><code>membership</code></td> <td> <p>a matrix with the membership values of the data points to the clusters.</p> </td></tr> <tr valign="top"><td><code>withinerror</code></td> <td> <p>the value of the objective function.</p> </td></tr> <tr valign="top"><td><code>call</code></td> <td> <p>the call used to create the object.</p> </td></tr> </table> <h3>Author(s)</h3> <p>Evgenia Dimitriadou and Kurt Hornik </p> <h3>References</h3> <p>J. C. Bezdek (1981). <em>Pattern recognition with fuzzy objective function algorithms</em>. New York: Plenum. </p> <p>Fu Lai Chung and Tong Lee (1992). Fuzzy competitive learning. <em>Neural Networks</em>, <b>7</b>(3), 539–551. </p> <p>Nikhil R. Pal, James C. Bezdek, and Richard J. Hathaway (1996). Sequential competitive learning and the fuzzy c-means clustering algorithms. <em>Neural Networks</em>, <b>9</b>(5), 787–796. </p> <h3>Examples</h3> <pre> # a 2-dimensional example x<-rbind(matrix(rnorm(100,sd=0.3),ncol=2), matrix(rnorm(100,mean=1,sd=0.3),ncol=2)) cl<-cmeans(x,2,20,verbose=TRUE,method="cmeans",m=2) print(cl) # a 3-dimensional example x<-rbind(matrix(rnorm(150,sd=0.3),ncol=3), matrix(rnorm(150,mean=1,sd=0.3),ncol=3), matrix(rnorm(150,mean=2,sd=0.3),ncol=3)) cl<-cmeans(x,6,20,verbose=TRUE,method="cmeans") print(cl) </pre> <hr /><div style="text-align: center;">[Package <em>e1071</em> version 1.7-3 <a href="00Index.html">Index</a>]</div> </body></html>