Vous êtes sur la page 1sur 2

Silhouette plot - MATLAB silhouette - MathWorks India

http://www.mathworks.in/help/stats/silhouette.html

silhouette
Syntax
silhouette(X,clust) s = silhouette(X,clust) [s,h] = silhouette(X,clust) [...] = silhouette(X,clust,metric) [...] = silhouette(X,clust,distfun,p1,p2,...)

Description
silhouette(X,clust) plots cluster silhouettes for the n-by-p data matrix X, with clusters defined by clust. Rows of X correspond to points, columns correspond to coordinates. clust can be a categorical variable, numeric vector, character matrix, or cell array of strings containing a cluster name for each point. silhouette treats NaNs or empty strings in clust as missing values, and ignores the corresponding rows of X. By default, silhouette uses the squared Euclidean distance between points in X. s = silhouette(X,clust) returns the silhouette values in the n-by-1 vector s, but does not plot the cluster silhouettes. [s,h] = silhouette(X,clust) plots the silhouettes, and returns the silhouette values in the n-by-1 vector s, and the figure handle in h. [...] = silhouette(X,clust,metric) plots the silhouettes using the inter-point distance function specified in metric. Choices for metric are given in the following table.
Metric Description

'Euclidean' 'sqEuclidean' 'cityblock' 'cosine' 'correlation' 'Hamming' 'Jaccard'

Euclidean distance Squared Euclidean distance (default) Sum of absolute differences One minus the cosine of the included angle between points (treated as vectors) One minus the sample correlation between points (treated as sequences of values) Percentage of coordinates that differ Percentage of nonzero coordinates that differ A numeric distance matrix in upper triangular vector form, such as is created by pdist. X is not used in this case, and can safely be set to [].

Vector

For more information on each metric, see Distance Metrics. [...] = silhouette(X,clust,distfun,p1,p2,...) accepts a function handle distfun to a metric of the form d = distfun(X0,X,p1,p2,...) where X0 is a 1-by-p point, X is an n-by-p matrix of points, and p1,p2,... are optional additional arguments. The function distfun returns an n-by-1 vector d of distances between X0 and each point (row) in X. The arguments p1, p2,... are passed directly to the function distfun.

Examples
X = [randn(10,2)+ones(10,2); randn(10,2)-ones(10,2)]; cidx = kmeans(X,2,'distance','sqeuclid'); s = silhouette(X,cidx,'sqeuclid');

Silhouette Value
Grouping Variables

expand all

References

1 of 2

27-06-2013 22:25

Silhouette plot - MATLAB silhouette - MathWorks India

http://www.mathworks.in/help/stats/silhouette.html

[1] Kaufman L., and P. J. Rousseeuw. Finding Groups in Data: An Introduction to Cluster Analysis . Hoboken, NJ: John Wiley & Sons, Inc., 1990.