Home > Mateda2.0 > otherfiles > ClusterPointsKmeans.m

ClusterPointsKmeans

PURPOSE ^

[index,nclusters] = ClusterPointsKmeans(data,distance,nclusters)

SYNOPSIS ^

function[index,nclusters] = ClusterPointsKmeans(data,distance,nclusters)

DESCRIPTION ^

 [index,nclusters] = ClusterPointsKmeans(data,distance,nclusters)
 ClusterPointsKmeans:  Clusters a data set using Affinity propagation
                         and a given distance. The number of clusters
                         is given.
 INPUT
 data: A vector of data were rows are observations and columns are
 features
 distance: Distance used for clustering (e.g. 'euclidean', 'correlation', 'cosine' ... See help pdist for full list of
                          possible metrics)
 nclusters: Number of  clusters.
 OUTPUT
 index: Cluster each solution belongs to
 nclusters: Number of clusters

 Example
 [index,nclusters] = ClusterPointsKmeans(rand(50,10),'sqEuclidean',5);
 
 Last version 8/26/2008. Roberto Santana (roberto.santana@ehu.es)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function[index,nclusters] = ClusterPointsKmeans(data,distance,nclusters)
0002 % [index,nclusters] = ClusterPointsKmeans(data,distance,nclusters)
0003 % ClusterPointsKmeans:  Clusters a data set using Affinity propagation
0004 %                         and a given distance. The number of clusters
0005 %                         is given.
0006 % INPUT
0007 % data: A vector of data were rows are observations and columns are
0008 % features
0009 % distance: Distance used for clustering (e.g. 'euclidean', 'correlation', 'cosine' ... See help pdist for full list of
0010 %                          possible metrics)
0011 % nclusters: Number of  clusters.
0012 % OUTPUT
0013 % index: Cluster each solution belongs to
0014 % nclusters: Number of clusters
0015 %
0016 % Example
0017 % [index,nclusters] = ClusterPointsKmeans(rand(50,10),'sqEuclidean',5);
0018 %
0019 % Last version 8/26/2008. Roberto Santana (roberto.santana@ehu.es)
0020 
0021 [index,c,sumd,d] = kmeans(data,nclusters,'Distance',distance,'EmptyAction','drop');
0022 
0023 nclusters = max(index);    
0024 return 
0025 
0026 
0027 
0028 
0029 
0030 
0031 
0032

Generated on Fri 04-Dec-2009 13:38:29 by m2html © 2003