* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Data Mining Clustering (2)
Survey
Document related concepts
Transcript
Data Mining Clustering (2) Toon Calders Sheets are based on the those provided by Tan, Steinbach, and Kumar. Introduction to Data Mining Outline • Partitional Clustering • Distance-based − K-means, K-medoids, Bisecting K-means • Density-based − DBSCAN • Hierarchical Clustering • Cluster validity 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 5 6 0.2 4 3 4 2 0.15 5 2 0.1 1 0.05 3 0 1 3 2 5 4 6 1 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, …) 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 Agglomerative Clustering Algorithm • More popular hierarchical clustering technique • Basic algorithm is straightforward 1. 2. 3. 4. 5. 6. • Compute the proximity matrix Let each data point be a cluster Repeat Merge the two closest clusters Update the proximity matrix 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 Starting Situation • Start with clusters of individual points and a proximity matrix p1 p2 p3 p4 p5 p1 p2 p3 p4 p5 . . . Proximity Matrix ... Intermediate Situation • After some merging steps, we have some clusters C1 C2 C3 C4 C1 C2 C3 C 3 C4 C 4 C5 Proximity Matrix C 1 C 2 C 5 C5 Intermediate Situation • We want to merge the two closest clusters (C2 and C5) and update the proximity matrix. C1 C2 C3 C4 C1 C2 C3 C 3 C4 C 4 C5 Proximity Matrix C 1 C 2 C 5 C5 After Merging • The question is “How do we update the proximity matrix?” C1 C1 C 3 C2 U C5 C 4 C2 U C5 C3 C4 ? ? ? ? ? C3 ? C4 ? Proximity Matrix C 1 C2 U C5 How to Define Inter-Cluster Similarity p1 p2 Similarity? 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 ... How to Define Inter-Cluster 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 ... How to Define Inter-Cluster 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 ... How to Define Inter-Cluster 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 ... How to Define Inter-Cluster 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 ... 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. 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 Hierarchical Clustering: MIN 1 5 3 5 0.2 2 1 2 3 0.15 6 0.1 0.05 4 4 Nested Clusters 0 3 6 2 5 Dendrogram 4 1 Strength of MIN Original Points • Can handle non-elliptical shapes Two Clusters Limitations of MIN Original Points • Sensitive to noise and outliers Two Clusters 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 I1 I1 1.00 I2 0.90 I3 0.10 I4 0.65 I5 0.20 I2 I3 I4 I5 0.90 0.10 0.65 0.20 1.00 0.70 0.60 0.50 0.70 1.00 0.40 0.30 0.60 0.40 1.00 0.80 0.50 0.30 0.80 1.00 1 2 3 4 5 Hierarchical Clustering: MAX 4 1 2 5 0.4 0.35 5 0.3 2 0.25 3 3 6 0.2 0.15 1 4 0.1 0.05 0 Nested Clusters 3 6 4 Dendrogram 1 2 5 Strength of MAX Original Points • Less susceptible to noise and outliers Two Clusters Limitations of MAX Original Points •Tends to break large clusters •Biased towards globular clusters Two Clusters Cluster Similarity: Group Average • Proximity of two clusters is the average of pairwise proximity between points in the two clusters. ∑ proximity(p , p ) i proximity(Clusteri , Clusterj ) = j pi∈Clusteri p j∈Clusterj |Clusteri |∗|Clusterj | • 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 Hierarchical Clustering: Group Average 5 4 1 0.25 2 5 0.2 2 0.15 3 6 1 0.1 0.05 4 3 Nested Clusters 0 3 6 4 1 Dendrogram 2 5 Hierarchical Clustering: Group Average • Compromise between Single and Complete Link • Strengths • Less susceptible to noise and outliers • Limitations • Biased towards globular clusters 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 Hierarchical Clustering: Comparison 1 5 4 3 2 5 2 5 1 2 1 MIN 3 5 2 MAX 6 3 3 4 1 4 4 1 5 5 2 5 6 4 1 2 Ward’s Method 2 3 3 6 5 2 Group Average 3 1 4 4 6 1 4 3 Hierarchical Clustering: Time and Space requirements • O(N2) space since it uses the proximity matrix. • N is the number of points. • O(N3) time in many cases • There are N steps and at each step the size, N2, proximity matrix must be updated and searched • Complexity can be reduced to O(N2 log(N) ) time for some approaches 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 Outline • Partitional Clustering • Distance-based − K-means, K-medoids, Bisecting K-means • Density-based − DBSCAN • Hierarchical Clustering • Cluster validity Cluster Validity • For supervised classification we have a variety of measures to evaluate how good our model is • Accuracy, precision, recall • For cluster analysis, the analogous question is how to evaluate the “goodness” of the resulting clusters? • But “clusters are in the eye of the beholder”! • 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 Clusters found in Random Data 1 0.9 0.9 0.8 0.8 0.7 0.7 0.6 0.6 0.5 0.5 y y Random Points 1 0.4 0.4 0.3 0.3 0.2 0.2 0.1 0.1 0 0 0.2 0.4 0.6 0.8 0 1 DBSCAN 0 0.2 0.4 x 1 1 0.9 0.9 0.8 0.8 0.7 0.7 0.6 0.6 0.5 0.5 y y Kmeans 0.4 0.4 0.3 0.3 0.2 0.2 0.1 0.1 0 0 0.2 0.4 0.6 x 0.6 0.8 1 x 0.8 1 0 Complete Link 0 0.2 0.4 0.6 x 0.8 1 Different Aspects of Cluster Validation 1. 2. 3. Determining the clustering tendency of a set of data, i.e., distinguishing whether non-random structure actually exists in the data. Comparing the results of a cluster analysis to externally known results, e.g., to externally given class labels. Evaluating how well the results of a cluster analysis fit the data without reference to external information. - Use only the data 4. 5. Comparing the results of two different sets of cluster analyses to determine which is better. Determining the ‘correct’ number of clusters. Measuring Cluster Validity Via Correlation 1 1 0.9 0.9 0.8 0.8 0.7 0.7 0.6 0.6 0.5 0.5 y y • Correlation of incidence and proximity matrices for the K-means clusterings of the following two data sets. 0.4 0.4 0.3 0.3 0.2 0.2 0.1 0.1 0 0 0.2 0.4 0.6 x Corr = -0.9235 0.8 1 0 0 0.2 0.4 0.6 x Corr = -0.5810 0.8 1 Using Similarity Matrix for Cluster Validation • Order the similarity matrix with respect to cluster labels and inspect visually. 1 1 0.9 0.8 0.7 Points y 0.6 0.5 0.4 0.3 0.2 0.1 0 10 0.9 20 0.8 30 0.7 40 0.6 50 0.5 60 0.4 70 0.3 80 0.2 90 0.1 100 0 0.2 0.4 0.6 x 0.8 1 20 40 60 Points 80 0 100 Similarity Using Similarity Matrix for Cluster Validation • Clusters in random data are not so crisp 1 10 0.9 0.9 20 0.8 0.8 30 0.7 0.7 40 0.6 0.6 50 0.5 0.5 60 0.4 0.4 70 0.3 0.3 80 0.2 0.2 90 0.1 0.1 100 20 40 60 80 0 100 Similarity Points y Points 1 0 0 0.2 0.4 0.6 x DBSCAN 0.8 1 Using Similarity Matrix for Cluster Validation • Clusters in random data are not so crisp 1 10 0.9 0.9 20 0.8 0.8 30 0.7 0.7 40 0.6 0.6 50 0.5 0.5 60 0.4 0.4 70 0.3 0.3 80 0.2 0.2 90 0.1 0.1 100 20 40 60 80 0 100 Similarity y Points 1 0 0 0.2 0.4 0.6 x Points K-means 0.8 1 Using Similarity Matrix for Cluster Validation • Clusters in random data are not so crisp 1 10 0.9 0.9 20 0.8 0.8 30 0.7 0.7 40 0.6 0.6 50 0.5 0.5 60 0.4 0.4 70 0.3 0.3 80 0.2 0.2 90 0.1 0.1 100 20 40 60 80 0 100 Similarity y Points 1 0 0 Points 0.2 0.4 0.6 x Complete Link 0.8 1 Using Similarity Matrix for Cluster Validation 1 0.9 500 1 2 0.8 6 0.7 1000 4 3 0.6 1500 0.5 0.4 2000 0.3 5 0.2 2500 0.1 7 3000 DBSCAN 500 1000 1500 2000 2500 3000 0 Conclusions • Partitional algorithms • K-means and its variations • Restricted to spherical clusters • Number of clusters needs to be set by user • DBSCAN • Any shape of cluster • Works only if density is uniform • Two parameters to set … • Hierarchical • Merging versus splitting (bisecting K-means) • Different criteria to determine distances between clusters Final Comment on Cluster Validity Cluster validity is very hard to check! Without a good validation, clustering is potentially just random. “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