Presentation is loading. Please wait.

Presentation is loading. Please wait.

Partitional and Hierarchical Based clustering Lecture 22 Based on Slides of Dr. Ikle & chapter 8 of Tan, Steinbach, Kumar.

Similar presentations


Presentation on theme: "Partitional and Hierarchical Based clustering Lecture 22 Based on Slides of Dr. Ikle & chapter 8 of Tan, Steinbach, Kumar."— Presentation transcript:

1 Partitional and Hierarchical Based clustering Lecture 22 Based on Slides of Dr. Ikle & chapter 8 of Tan, Steinbach, Kumar

2 1. What is Cluster Analysis? Finding groups of objects such that the objects in a group will be similar (or related) to one another and different from (or unrelated to) the objects in other groups Inter-cluster distances are maximized Intra-cluster distances are minimized

3 Biology: kingdom, phylum, class, order, family, genus, and species Information Retrieval: search engine query = movie, clusters = reviews, trailers, stars, theaters Climate: Clusters = regions of similar climate Psychology and Medicine: patterns in spatial or temporal distribution of a disease Business: Segment customers into groups for marketing activities Examples of Clustering

4 Clustering for Understanding (see examples from previous slide) Clustering for Utility Summarizing: different algorithms can run faster on a data set summarized by clustering Compression: storing cluster information is more efficient that storing the entire data - example: quantization Finding Nearest Neighbors Two Reasons for Clustering

5 Applications of Cluster Analysis Understanding Group related documents for browsing, group genes and proteins that have similar functionality, or group stocks with similar price fluctuations Summarization Reduce the size of large data sets Clustering precipitation in Australia

6 CLUSTERING: Introduction Clustering No class to be predicted Groups objects based solely on their attributes Objects within clusters similar to each other Objects in different clusters dissimilar to each other Depends on similarity measure Clustering as unsupervised classification

7 CLUSTERING: Introduction What constitute clusters? The answer is not always clear

8 CLUSTERING: Introduction Grouping of text clusters

9 CLUSTERING: Introduction Types of clustering Partitional Simple division of instances into mutually exclusive (non-overlapping) clusters Determine desired number of clusters Iteratively reallocate objects to clusters

10 1: Introduction Types of clustering Hierarchical Clusters allowed to have (nested) subclusters Uses previous clusters to find subclusters Types of hierarchical algorithms Agglomerative (bottom-up) Merge smaller clusters Divisive (top-down) Divide larger clusters

11 CLUSTERING: Common Algorithms Partitional K-means K-medoids Density-based DBSCAN SNN

12 K-means clustering is one of the most common/popular techniques Each cluster is associated with a centroid (center point) – this is often the mean – it is the cluster prototype Each point is assigned to the cluster with the closest centroid The number of clusters, K, must be specified ahead of time 2. K-Means Clustering

13 The most common version of k-means minimizes the sum of the squared distances of each point from its cluster center (page 500) For a given set of cluster centers, (obviously) each point should be matched to the nearest center For a given cluster, the best center is the mean The basic algorithm is to iterate over these two relationships K-Means Clustering

14 2. CLUSTERING: K-means Pseudo-code Choose number of clusters, k Initialize k centroids (randomly, for example) Repeat Form k clusters by assigning each point to its nearest centroid Recalculate centroids Until convergence (centroids move less than some amount)

15 CLUSTERING: K-means Time complexity O(n*k*l*d) n=number of points k=number of clusters l=number of iterations d=number of attributes Space complexity O(k+n)

16 CLUSTERING: K-means Time complexity O(n*k*l*d) n=number of points k=number of clusters l=number of iterations d=number of attributes Space complexity O(k+n)

17 K-means disadvantages Bad choice for k may yield poor results Fixed number of clusters makes it difficult to determine best value for k Dependent upon choice of initial centroids Really only works well for “spherical” cluster shapes

18 CLUSTERING: K-means advantages Simple and effective Conceptually To implement To run Other algorithms require more parameters to adjust Relatively quick

19 CLUSTERING: K-means solutions One does not always need high quality clusters Can use multiple runs to help with initial centroids Choose best final result Probability is not your friend Run with different values for k and obtain the best result Produce hierarchical clustering Set k=2 Repeat recursively within each cluster

20 CLUSTERING: K-means solutions One does not always need high quality clusters Can use multiple runs to help with initial centroids Choose best final result Probability is not your friend Run with different values for k and obtain the best result Produce hierarchical clustering Set k=2 Repeat recursively within each cluster

21 3. Hierarchical 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

22 Strengths 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, …)

23 Hierarchical 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, all-inclusive 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

24 Agglomerative 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

25 Starting Situation Start with clusters of individual points and a proximity matrix p1 p3 p5 p4 p2 p1p2p3p4p5......... Proximity Matrix

26 Intermediate Situation After some merging steps, we have some clusters C1 C4 C2 C5 C3 C2C1 C3 C5 C4 C2 C3C4C5 Proximity Matrix

27 Intermediate Situation We want to merge the two closest clusters (C2 and C5) and update the proximity matrix. C1 C4 C2 C5 C3 C2C1 C3 C5 C4 C2 C3C4C5 Proximity Matrix

28 After Merging The question is “How do we update the proximity matrix?” C1 C4 C2 U C5 C3 ? ? ? ? ? C2 U C5 C1 C3 C4 C2 U C5 C3C4 Proximity Matrix

29 How to Define Inter-Cluster Similarity p1 p3 p5 p4 p2 p1p2p3p4p5......... Similarity? l MIN l MAX l Group Average l Distance Between Centroids l Other methods driven by an objective function –Ward’s Method uses squared error Proximity Matrix

30 How to Define Inter-Cluster Similarity p1 p3 p5 p4 p2 p1p2p3p4p5......... Proximity Matrix l MIN l MAX l Group Average l Distance Between Centroids l Other methods driven by an objective function –Ward’s Method uses squared error

31 How to Define Inter-Cluster Similarity p1 p3 p5 p4 p2 p1p2p3p4p5......... Proximity Matrix l MIN l MAX l Group Average l Distance Between Centroids l Other methods driven by an objective function –Ward’s Method uses squared error

32 How to Define Inter-Cluster Similarity p1 p3 p5 p4 p2 p1p2p3p4p5......... Proximity Matrix l MIN l MAX l Group Average l Distance Between Centroids l Other methods driven by an objective function –Ward’s Method uses squared error

33 How to Define Inter-Cluster Similarity p1 p3 p5 p4 p2 p1p2p3p4p5......... Proximity Matrix l MIN l MAX l Group Average l Distance Between Centroids l Other methods driven by an objective function –Ward’s Method uses squared error 

34 Cluster 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. 12345

35 Hierarchical Clustering: MIN Nested ClustersDendrogram 1 2 3 4 5 6 1 2 3 4 5

36 Strength of MIN Original Points Two Clusters Can handle non-elliptical shapes

37 Limitations of MIN Original Points Two Clusters Sensitive to noise and outliers

38 Cluster 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 12345

39 Hierarchical Clustering: MAX Nested ClustersDendrogram 1 2 3 4 5 6 1 2 5 3 4

40 Strength of MAX Original Points Two Clusters Less susceptible to noise and outliers

41 Limitations of MAX Original Points Two Clusters Tends to break large clusters Biased towards globular clusters

42 Cluster Similarity: Group Average Proximity of two clusters is the average of pairwise proximity between points in the two clusters. Need to use average connectivity for scalability since total proximity favors large clusters 12345

43 Hierarchical Clustering: Group Average Nested ClustersDendrogram 1 2 3 4 5 6 1 2 5 3 4

44 Hierarchical Clustering: Group Average Compromise between Single and Complete Link Strengths Less susceptible to noise and outliers Limitations Biased towards globular clusters

45 Cluster 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 K-means Can be used to initialize K-means

46 Hierarchical Clustering: Comparison Group Average Ward’s Method 1 2 3 4 5 6 1 2 5 3 4 MINMAX 1 2 3 4 5 6 1 2 5 3 4 1 2 3 4 5 6 1 2 5 3 4 1 2 3 4 5 6 1 2 3 4 5

47 Hierarchical Clustering: Time and Space requirements O(N 2 ) space since it uses the proximity matrix. N is the number of points. O(N 3 ) time in many cases There are N steps and at each step the size, N 2, proximity matrix must be updated and searched Complexity can be reduced to O(N 2 log(N) ) time for some approaches

48 Hierarchical Clustering: Problems and Limitations Once a decision is made to combine two clusters, it cannot be undone No objective function is directly minimized Different schemes have problems with one or more of the following: Sensitivity to noise and outliers Difficulty handling different sized clusters and convex shapes Breaking large clusters


Download ppt "Partitional and Hierarchical Based clustering Lecture 22 Based on Slides of Dr. Ikle & chapter 8 of Tan, Steinbach, Kumar."

Similar presentations


Ads by Google