Question? Leave a message!




Hierarchical Clustering

Hierarchical Clustering
Hierarchical Clustering www.ThesisScientist.comHierarchical Clustering Produces a set of nested clusters organized as a hierarchical tree Can be visualized as a dendrogram  A tree like diagram that records the sequences of merges or splits 5 6 0.2 4 3 4 2 0.15 5 2 0.1 1 0.05 1 3 0 1 3 2 5 4 6 www.ThesisScientist.comStrengths of Hierarchical Clustering Do not have to assume any particular number of clusters  Any desired number of clusters can be obtained by „cutting‟ the dendogram at the proper level They may correspond to meaningful taxonomies  Example in biological sciences (e.g., animal kingdom, phylogeny reconstruction, …) www.ThesisScientist.comHierarchical Clustering  Two main types of hierarchical clustering  Agglomerative:  Start with the points as individual clusters  At each step, merge the closest pair of clusters until only one cluster (or k clusters) left  Divisive:  Start with one, allinclusive cluster  At each step, split a cluster until each cluster contains a point (or there are k clusters)  Traditional hierarchical algorithms use a similarity or distance matrix  Merge or split one cluster at a time www.ThesisScientist.comAgglomerative Clustering Algorithm  More popular hierarchical clustering technique  Basic algorithm is straightforward 1. Compute the proximity matrix 2. Let each data point be a cluster 3. Repeat 4. Merge the two closest clusters 5. Update the proximity matrix 6. Until only a single cluster remains  Key operation is the computation of the proximity of two clusters  Different approaches to defining the distance between clusters distinguish the different algorithms www.ThesisScientist.comStarting Situation Start with clusters of individual points and p1 p2 p3 p4 p5 . . . a proximity matrix p1 p2 p3 p4 p5 . . . Proximity Matrix ... p1 p2 p3 p4 p9 p10 p11 p12 www.ThesisScientist.comIntermediate Situation C1 C2 C3 C4 C5  After some merging steps, we have some clusters C1 C2 C3 C3 C4 C4 C5 Proximity Matrix C1 C5 C2 ... p1 p2 p3 p4 p9 p10 p11 p12 www.ThesisScientist.comIntermediate Situation C1 C2 C3 C4 C5  We want to merge the two closest clusters (C2 and C1 C5) and update the proximity matrix. C2 C3 C3 C4 C4 C5 Proximity Matrix C1 C5 C2 ... p1 p2 p3 p4 p9 p10 p11 p12 www.ThesisScientist.comAfter Merging C2  The question is “How do we update the proximity U C1 C5 C3 C4 matrix” C1 C2 U C5 C3 C3 C4 C4 Proximity Matrix C1 C2 U C5 ... p1 p2 p3 p4 p9 p10 p11 p12 www.ThesisScientist.comHow to Define InterCluster Similarity p1 p2 p3 p4 p5 . . . p1 Similarity p2 p3 p4 p5  MIN .  MAX .  Group Average . Proximity Matrix  Distance Between Centroids  Other methods driven by an objective function  Ward‟s Method uses squared error www.ThesisScientist.comHow to Define InterCluster Similarity p1 p2 p3 p4 p5 . . . p1 p2 p3 p4 p5  MIN .  MAX .  Group Average . Proximity Matrix  Distance Between Centroids  Other methods driven by an objective function  Ward‟s Method uses squared error www.ThesisScientist.comHow to Define InterCluster Similarity p1 p2 p3 p4 p5 . . . p1 p2 p3 p4 p5  MIN .  MAX .  Group Average . Proximity Matrix  Distance Between Centroids  Other methods driven by an objective function  Ward‟s Method uses squared error www.ThesisScientist.comHow to Define InterCluster Similarity p1 p2 p3 p4 p5 . . . p1 p2 p3 p4 p5  MIN .  MAX .  Group Average . Proximity Matrix  Distance Between Centroids  Other methods driven by an objective function  Ward‟s Method uses squared error www.ThesisScientist.comHow to Define InterCluster Similarity p1 p2 p3 p4 p5 . . . p1  p2 p3 p4 p5  MIN .  MAX .  Group Average . Proximity Matrix  Distance Between Centroids  Other methods driven by an objective function  Ward‟s Method uses squared error www.ThesisScientist.comCluster Similarity: MIN or Single Link Similarity of two clusters is based on the two most similar (closest) points in the different clusters  Determined by one pair of points, i.e., by one link in the proximity graph. I1 I2 I3 I4 I5 I1 1.00 0.90 0.10 0.65 0.20 I2 0.90 1.00 0.70 0.60 0.50 I3 0.10 0.70 1.00 0.40 0.30 I4 0.65 0.60 0.40 1.00 0.80 I5 0.20 0.50 0.30 0.80 1.00 1 2 3 4 5 www.ThesisScientist.comHierarchical Clustering: MIN 5 1 3 0.2 5 2 1 0.15 2 3 6 0.1 0.05 4 0 4 3 6 2 5 4 1 Nested Clusters Dendrogram www.ThesisScientist.comStrength of MIN Original Points Two Clusters • Can handle nonelliptical shapes www.ThesisScientist.comLimitations of MIN Original Points Two Clusters • Sensitive to noise and outliers www.ThesisScientist.comCluster Similarity: MAX or Complete Linkage Similarity of two clusters is based on the two least similar (most distant) points in the different clusters  Determined by all pairs of points in the two clusters I1 I2 I3 I4 I5 I1 1.00 0.90 0.10 0.65 0.20 I2 0.90 1.00 0.70 0.60 0.50 I3 0.10 0.70 1.00 0.40 0.30 I4 0.65 0.60 0.40 1.00 0.80 I5 0.20 0.50 0.30 0.80 1.00 1 2 3 4 5 www.ThesisScientist.comHierarchical Clustering: MAX 4 1 0.4 2 5 0.35 5 0.3 2 0.25 0.2 3 6 0.15 3 1 0.1 0.05 4 0 3 6 4 1 2 5 Nested Clusters Dendrogram www.ThesisScientist.comStrength of MAX Original Points Two Clusters • Less susceptible to noise and outliers www.ThesisScientist.comLimitations of MAX Original Points Two Clusters •Tends to break large clusters •Biased towards globular clusters www.ThesisScientist.comCluster Similarity: Group Average  Proximity of two clusters is the average of pairwise proximity(p ,p )  i j proximity between points in the two clusters. pCluster i i pCluster j j proximity(Cluster,Cluster) i j ClusterCluster i j  Need to use average connectivity for scalability since total proximity favors large clusters I1 I2 I3 I4 I5 I1 1.00 0.90 0.10 0.65 0.20 I2 0.90 1.00 0.70 0.60 0.50 I3 0.10 0.70 1.00 0.40 0.30 I4 0.65 0.60 0.40 1.00 0.80 I5 0.20 0.50 0.30 0.80 1.00 1 2 3 4 5 www.ThesisScientist.comHierarchical Clustering: Group Average 5 4 1 0.25 2 0.2 5 2 0.15 3 6 0.1 1 0.05 4 0 3 6 4 1 2 5 3 Nested Clusters Dendrogram www.ThesisScientist.comHierarchical Clustering: Group Average  Compromise between Single and Complete Link  Strengths  Less susceptible to noise and outliers  Limitations  Biased towards globular clusters www.ThesisScientist.comCluster Similarity: Ward’s Method Similarity of two clusters is based on the increase in squared error when two clusters are merged  Similar to group average if distance between points is distance squared Less susceptible to noise and outliers Biased towards globular clusters Hierarchical analogue of Kmeans www.ThesisScientist.com  Can be used to initialize KmeansHierarchical Clustering: Comparison 5 1 4 1 3 2 5 5 5 2 1 2 MIN MAX 2 3 6 3 6 3 1 4 4 4 5 5 1 4 1 2 2 5 Ward’s Method 5 2 2 Group Average 3 3 6 6 3 1 1 4 4 4 3 www.ThesisScientist.comHierarchical Clustering: Time and Space requirements 2 O(N ) space since it uses the proximity matrix.  N is the number of points. 3 O(N ) time in many cases  There are N steps and at each step the size, 2 N , proximity matrix must be updated and searched 2  Complexity can be reduced to O(N log(N) ) time for some approaches www.ThesisScientist.comCURE (Clustering Using REpresentatives ) data to be clustered clusters generated by conventional methods (e.g., kmeans, BIRCH)  CURE: proposed by Guha, Rastogi Shim, 1998  Stops the creation of a cluster hierarchy if a level consists of k clusters  Uses multiple representative points to evaluate the distance between clusters, adjusts well to arbitrary shaped clusters and avoids singlelink effect www.ThesisScientist.comCure: The Algorithm  Draw random sample s.  Partition sample to p partitions with size s/p  Partially cluster partitions into s/pq clusters  Eliminate outliers  By random sampling  If a cluster grows too slow, eliminate it.  Cluster partial clusters.  Label data in disk www.ThesisScientist.comCURE: cluster representation  Uses a number of points to represent a cluster   Representative points are found by selecting a constant number of points from a cluster and then “shrinking” them toward the center of the cluster  Cluster similarity is the similarity of the closest pair of representative points from different www.ThesisScientist.com clustersCURE Shrinking representative points toward the center helps avoid problems with noise and outliers CURE is better able to handle clusters of arbitrary shapes and sizes www.ThesisScientist.comExperimental Results: CURE Picture from CURE, Guha, Rastogi, Shim. www.ThesisScientist.comExperimental Results: CURE (centroid) (single link) Picture from CURE, Guha, Rastogi, Shim. www.ThesisScientist.comCURE Cannot Handle Differing Densities CURE Original Points www.ThesisScientist.comROCK (RObust Clustering using linKs)  Clustering algorithm for data with categorical and Boolean attributes  A pair of points is defined to be neighbors if their similarity is greater than some threshold  Use a hierarchical clustering scheme to cluster the data. 1. Obtain a sample of points from the data set 2. Compute the link value for each set of points, i.e., transform the original similarities (computed by Jaccard coefficient) into similarities that reflect the number of shared neighbors between points 3. Perform an agglomerative hierarchical clustering on the data using the “number of shared neighbors” as similarity measure and maximizing “the shared neighbors” objective function 4. Assign the remaining points to the clusters that have been www.ThesisScientist.com foundClustering Categorical Data: The ROCK Algorithm  ROCK: RObust Clustering using linKs  S. Guha, R. Rastogi K. Shim, ICDE‟99  Major ideas  Use links to measure similarity/proximity  Not distancebased  Computational complexity: 2 2 O(nnmmn logn) m a www.ThesisScientist.comSimilarity Measure in ROCK  Traditional measures for categorical data may not work well, e.g., Jaccard coefficient  Example: Two groups (clusters) of transactions  C . a, b, c, d, e: a, b, c, a, b, d, a, b, e, a, c, d, 1 a, c, e, a, d, e, b, c, d, b, c, e, b, d, e, c, d, e  C . a, b, f, g: a, b, f, a, b, g, a, f, g, b, f, g 2  Jaccard coefficient may lead to wrong clustering result  C : 0.2 (a, b, c, b, d, e to 0.5 (a, b, c, a, b, d) 1  C C : could be as high as 0.5 (a, b, c, a, b, f) 1 2  Jaccard coefficientbased similarity function: TT 1 2 Sim(T ,T ) 1 2 TT  Ex. Let T = a, b, c, T = c, d, e 1 2 1 2 c 1 Sim(T 1,T 2) 0.2 a,b,c,d,e 5 www.ThesisScientist.comLink Measure in ROCK  Links: of common neighbors  C a, b, c, d, e: a, b, c, a, b, d, a, b, e, a, c, d, 1 a, c, e, a, d, e, b, c, d, b, c, e, b, d, e, c, d, e  C a, b, f, g: a, b, f, a, b, g, a, f, g, b, f, g 2  Let T = a, b, c, T = c, d, e, T = a, b, f 1 2 3  link(T T ) = 4, since they have 4 common neighbors 1, 2  a, c, d, a, c, e, b, c, d, b, c, e  link(T T ) = 3, since they have 3 common neighbors 1, 3  a, b, d, a, b, e, a, b, g  Thus link is a better measure than Jaccard coefficient www.ThesisScientist.comCHAMELEON: Hierarchical Clustering Using Dynamic Modeling (1999)  CHAMELEON: by G. Karypis, E.H. Han, and V. Kumar’99  Measures the similarity based on a dynamic model  Two clusters are merged only if the interconnectivity and closeness (proximity) between two clusters are high relative to the internal interconnectivity of the clusters and closeness of items within the clusters  Cure ignores information about interconnectivity of the objects, Rock ignores information about the closeness of two clusters  A twophase algorithm 1. Use a graph partitioning algorithm: cluster objects into a large number of relatively small subclusters 2. Use an agglomerative hierarchical clustering algorithm: find the genuine clusters by repeatedly combining these subclusters www.ThesisScientist.comOverall Framework of CHAMELEON Construct Partition the Graph Sparse Graph Data Set Merge Partition Final Clusters www.ThesisScientist.comCHAMELEON (Clustering Complex Objects) www.ThesisScientist.comCluster Analysis  What is Cluster Analysis  Types of Data in Cluster Analysis  A Categorization of Major Clustering Methods  Partitioning Methods  Hierarchical Methods  DensityBased Methods  GridBased Methods  ModelBased Clustering Methods  Outlier Analysis  Summary www.ThesisScientist.comDensityBased Clustering Methods  Clustering based on density (local cluster criterion), such as densityconnected points  Major features:  Discover clusters of arbitrary shape  Handle noise  One scan  Need density parameters as termination condition  Several interesting studies:  DBSCAN: Ester, et al. (KDD’96)  OPTICS: Ankerst, et al (SIGMOD’99).  DENCLUE: Hinneburg D. Keim (KDD’98)  CLIQUE: Agrawal, et al. (SIGMOD’98) www.ThesisScientist.comDensityBased Clustering: Background  Neighborhood of point p=all points within distance e from p:  N (p)=q dist(p,q) = e Eps  Two parameters: e : Maximum radius of the neighbourhood  MinPts: Minimum number of points in an e neighbourhood of that point  If the number of points in the e neighborhood of p is at least MinPts, then p is called a core object.  Directly densityreachable: A point p is directly density reachable from a point q wrt. e, MinPts if  1) p belongs to N (q) Eps p MinPts = 5  2) core point condition: q N (q) = MinPts e = 1 cm Eps www.ThesisScientist.comDensityBased Clustering: Background (II)  Densityreachable: p  A point p is densityreachable from a point q wrt. Eps, MinPts if there is p 1 a chain of points p , …, p , p = q, q 1 n 1 p = p such that p is directly n i+1 densityreachable from p i  Densityconnected  A point p is densityconnected to a point q wrt. Eps, MinPts if there is a p q point o such that both, p and q are densityreachable from o wrt. Eps o and MinPts. www.ThesisScientist.comDBSCAN: Density Based Spatial Clustering of Applications with Noise  Relies on a densitybased notion of cluster: A cluster is defined as a maximal set of density connected points  Discovers clusters of arbitrary shape in spatial databases with noise Outlier Border Eps = 1cm Core MinPts = 5 www.ThesisScientist.comDBSCAN: The Algorithm  Arbitrary select a point p  Retrieve all points densityreachable from p wrt Eps and MinPts.  If p is a core point, a cluster is formed.  If p is a border point, no points are densityreachable from p and DBSCAN visits the next point of the database.  Continue the process until all of the points have been processed. www.ThesisScientist.com
Website URL
Comment