Presentation is loading. Please wait.

Presentation is loading. Please wait.

Data Mining Cluster Analysis: Basic Concepts and Algorithms Lecture Notes for Chapter 8 Introduction to Data Mining by Tan, Steinbach, Kumar © Tan,Steinbach,

Similar presentations


Presentation on theme: "Data Mining Cluster Analysis: Basic Concepts and Algorithms Lecture Notes for Chapter 8 Introduction to Data Mining by Tan, Steinbach, Kumar © Tan,Steinbach,"— Presentation transcript:

1 Data Mining Cluster Analysis: Basic Concepts and Algorithms Lecture Notes for Chapter 8 Introduction to Data Mining by Tan, Steinbach, Kumar © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 1

2 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 2 Hierarchical Clustering l Produces a set of nested clusters organized as a hierarchical tree l Can be visualized as a dendrogram –A tree like diagram that records the sequences of merges or splits

3 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 3 Strengths of Hierarchical Clustering l 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 l They may correspond to meaningful taxonomies –Example in biological sciences (e.g., animal kingdom, phylogeny reconstruction, …)

4 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 4 Hierarchical Clustering l 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) l Traditional hierarchical algorithms use a similarity or distance matrix –Merge or split one cluster at a time

5 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 5 Agglomerative Clustering Algorithm l More popular hierarchical clustering technique l 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 l Key operation is the computation of the proximity of two clusters –Different approaches to defining the distance between clusters distinguish the different algorithms

6 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 6 Starting Situation l Start with clusters of individual points and a proximity matrix p1 p3 p5 p4 p2 p1p2p3p4p5......... Proximity Matrix

7 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 7 Intermediate Situation l After some merging steps, we have some clusters C1 C4 C2 C5 C3 C2C1 C3 C5 C4 C2 C3C4C5 Proximity Matrix

8 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 8 Intermediate Situation l 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

9 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 9 After Merging l 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

10 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 10 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

11 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 11 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

12 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 12 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

13 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 13 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

14 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 14 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 

15 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 15 Cluster Similarity: MIN or Single Link l 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

16 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 16 Hierarchical Clustering: MIN Nested ClustersDendrogram 1 2 3 4 5 6 1 2 3 4 5

17 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 17 Strength of MIN Original Points Two Clusters Can handle non-elliptical shapes

18 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 18 Limitations of MIN Original Points Two Clusters Sensitive to noise and outliers

19 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 19 Cluster Similarity: MAX or Complete Linkage l 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

20 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 20 Hierarchical Clustering: MAX Nested ClustersDendrogram 1 2 3 4 5 6 1 2 5 3 4

21 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 21 Strength of MAX Original Points Two Clusters Less susceptible to noise and outliers

22 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 22 Limitations of MAX Original Points Two Clusters Tends to break large clusters Biased towards globular clusters

23 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 23 Cluster Similarity: Group Average l Proximity of two clusters is the average of pairwise proximity between points in the two clusters. l Need to use average connectivity for scalability since total proximity favors large clusters 12345

24 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 24 Hierarchical Clustering: Group Average Nested ClustersDendrogram 1 2 3 4 5 6 1 2 5 3 4

25 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 25 Hierarchical Clustering: Group Average l Compromise between Single and Complete Link l Strengths –Less susceptible to noise and outliers l Limitations –Biased towards globular clusters

26 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 26 Hierarchical Clustering: Problems and Limitations l Once a decision is made to combine two clusters, it cannot be undone l No objective function is directly minimized l 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

27 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 27 DBSCAN l DBSCAN is a density-based algorithm. –Density = number of points within a specified radius (Eps) –A point is a core point if it has more than a specified number of points (MinPts) within Eps  These are points that are at the interior of a cluster –A border point has fewer than MinPts within Eps, but is in the neighborhood of a core point –A noise point is any point that is not a core point or a border point.

28 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 28 DBSCAN: Core, Border, and Noise Points

29 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 29 DBSCAN Algorithm l Eliminate noise points l Perform clustering on the remaining points

30 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 30 DBSCAN: Core, Border and Noise Points Original Points Point types: core, border and noise Eps = 10, MinPts = 4

31 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 31 When DBSCAN Works Well Original Points Clusters Resistant to Noise Can handle clusters of different shapes and sizes

32 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 32 When DBSCAN Does NOT Work Well Original Points (MinPts=4, Eps=9.75). (MinPts=4, Eps=9.92) Varying densities High-dimensional data

33 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 33 Cluster Validity l For supervised classification we have a variety of measures to evaluate how good our model is –Accuracy, precision, recall l For cluster analysis, the analogous question is how to evaluate the “goodness” of the resulting clusters? l But “clusters are in the eye of the beholder”! l Then why do we want to evaluate them? –To avoid finding patterns in noise –To compare clustering algorithms –To compare two sets of clusters –To compare two clusters

34 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 34 l Order the similarity matrix with respect to cluster labels and inspect visually. Using Similarity Matrix for Cluster Validation

35 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 35 Using Similarity Matrix for Cluster Validation l Clusters in random data are not so crisp DBSCAN

36 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 36 Using Similarity Matrix for Cluster Validation l Clusters in random data are not so crisp K-means

37 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 37 Using Similarity Matrix for Cluster Validation l Clusters in random data are not so crisp Complete Link

38 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 38 Using Similarity Matrix for Cluster Validation DBSCAN

39 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 39 l Clusters in more complicated figures aren’t well separated l Internal Index: Used to measure the goodness of a clustering structure without respect to external information –SSE l SSE is good for comparing two clusterings or two clusters (average SSE). l Can also be used to estimate the number of clusters Internal Measures: SSE

40 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 40 Internal Measures: SSE l SSE curve for a more complicated data set SSE of clusters found using K-means

41 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 41 l Need a framework to interpret any measure. –For example, if our measure of evaluation has the value, 10, is that good, fair, or poor? l Statistics provide a framework for cluster validity –The more “atypical” a clustering result is, the more likely it represents valid structure in the data –Can compare the values of an index that result from random data or clusterings to those of a clustering result.  If the value of the index is unlikely, then the cluster results are valid –These approaches are more complicated and harder to understand. l For comparing the results of two different sets of cluster analyses, a framework is less necessary. –However, there is the question of whether the difference between two index values is significant Framework for Cluster Validity

42 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 42 l Example –Compare SSE of 0.005 against three clusters in random data –Histogram shows SSE of three clusters in 500 sets of random data points of size 100 distributed over the range 0.2 – 0.8 for x and y values Statistical Framework for SSE

43 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 43 l Correlation of incidence and proximity matrices for the K-means clusterings of the following two data sets. Statistical Framework for Correlation Corr = -0.9235Corr = -0.5810

44 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 44 l Cluster Cohesion: Measures how closely related are objects in a cluster –Example: SSE l Cluster Separation: Measure how distinct or well- separated a cluster is from other clusters l Example: Squared Error –Cohesion is measured by the within cluster sum of squares (SSE) –Separation is measured by the between cluster sum of squares –Where |C i | is the size of cluster i Internal Measures: Cohesion and Separation

45 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 45 Internal Measures: Cohesion and Separation l Example: SSE –BSS + WSS = constant 12345  m1m1 m2m2 m K=2 clusters: K=1 cluster:

46 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 46 l A proximity graph based approach can also be used for cohesion and separation. –Cluster cohesion is the sum of the weight of all links within a cluster. –Cluster separation is the sum of the weights between nodes in the cluster and nodes outside the cluster. Internal Measures: Cohesion and Separation cohesionseparation

47 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 47 l Silhouette Coefficient combine ideas of both cohesion and separation, but for individual points, as well as clusters and clusterings l For an individual point, i –Calculate a = average distance of i to the points in its cluster –Calculate b = min (average distance of i to points in another cluster) –The silhouette coefficient for a point is then given by s = 1 – a/b if a < b, (or s = b/a - 1 if a  b, not the usual case) –Typically between 0 and 1. –The closer to 1 the better. l Can calculate the Average Silhouette width for a cluster or a clustering Internal Measures: Silhouette Coefficient

48 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 48 External Measures of Cluster Validity: Entropy and Purity

49 © Tan,Steinbach, Kumar Introduction to Data Mining 4/18/2004 49 “The validation of clustering structures is the most difficult and frustrating part of cluster analysis. Without a strong effort in this direction, cluster analysis will remain a black art accessible only to those true believers who have experience and great courage.” Algorithms for Clustering Data, Jain and Dubes Final Comment on Cluster Validity


Download ppt "Data Mining Cluster Analysis: Basic Concepts and Algorithms Lecture Notes for Chapter 8 Introduction to Data Mining by Tan, Steinbach, Kumar © Tan,Steinbach,"

Similar presentations


Ads by Google