html5-img
1 / 132

Clustering Prof. Navneet Goyal BITS, Pilani

Clustering Prof. Navneet Goyal BITS, Pilani. Inter-cluster distances are maximized. Intra-cluster distances are minimized. What is Cluster Analysis?.

bessie
Télécharger la présentation

Clustering Prof. Navneet Goyal BITS, Pilani

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ClusteringProf. Navneet GoyalBITS, Pilani

  2. Inter-cluster distances are maximized Intra-cluster distances are minimized 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

  3. Clustering • Clustering of data is a method by which large sets of data is grouped into clusters of smaller sets of similar data • Objects in one cluster have high similarity to each other and are dissimilar to objects in other clusters • An example of unsupervised learning • Group objects that share common characteristics

  4. Clustering Applications • Segmentcustomer database based on similar buying patterns. • Group houses in a town into neighborhoods based on similar features. • Identify new plant species • Identify similar Web usage patterns

  5. Clustering Applications • Marketing: Help marketers discover distinct groups in their customer bases, and then use this knowledge to develop targeted marketing programs • Land use: Identification of areas of similar land use in an earth observation database • Insurance: Identifying groups of motor insurance policy holders with a high average claim cost • City-planning: Identifying groups of houses according to their house type, value, and geographical location • Earth-quake studies: Observed earth quake epicenters should be clustered along continent faults

  6. 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

  7. Clustering Applications • Many years ago, during a cholera outbreak in London, a physician plotted the location of cases on amap, getting a plot that looked like Fig. 14. Properly visualized, the data indicated that cases clustered around certain intersections, where there were polluted wells, not only exposing the cause of cholera, but indicating what to do about the problem. Alas, not all data mining is this easy, often because the clusters are in so many dimensions that visualization is very hard.

  8. Clustering Applications • Skycat clustered 2x109 sky objects into stars, galaxies, quasars, etc. Each object was a point in aspace of 7 dimensions, with each dimension representing radiation in one band of the spectrum. The Sloan Sky Survey is a more ambitious attempt to catalog and cluster the entire visible universe. • Documents may be thought of as points in a high-dimensional space, where each dimension corresponds to one possible word. The position of a document in a dimension is the number of times the word occurs in the document (or just 1 if it occurs, 0 if not). Clusters of documents in this space often correspond to groups of documents on the same topic.

  9. Clustering Example

  10. Size Based Geographic Distance Based Clustering Houses

  11. How many clusters? Six Clusters Two Clusters Four Clusters Notion of a Cluster can be Ambiguous

  12. Clustering vs. Classification • No prior knowledge • Number of clusters • Meaning of clusters • Unsupervised learning

  13. Types of Clusterings • A clustering is a set of clusters • Important distinction between hierarchical and partitionalsets of clusters • Partitional Clustering • A division data objects into non-overlapping subsets (clusters) such that each data object is in exactly one subset • Hierarchical clustering • A set of nested clusters organized as a hierarchical tree

  14. A Partitional Clustering Partitional Clustering Original Points

  15. Hierarchical Clustering Traditional Hierarchical Clustering Traditional Dendrogram Non-traditional Hierarchical Clustering Non-traditional Dendrogram

  16. Clustering Issues • Outlier handling • Dynamic data • Interpreting results • Evaluating results • Number of clusters • Data to be used • Scalability

  17. Types of Data in Cluster Analysis Data matrix

  18. Types of Data in Cluster Analysis Dissimilarity Matrix

  19. Dissimilarity Matrix • Many clustering algorithms operate on dissimilarity matrix • If data matrix is given, it needs to be transformed into a dissimilarity matrix first • How can we assess dissimilarity d(i,j)?

  20. Types of Data • Interval-scaled variables • Binary variables • Nominal, ordinal, and ratio variables • Variables of mixed types

  21. Interval-scales Variables • Continuous measurements of a roughly linear scale • Weight, height, latitude and longitude coordinates, temperature, etc. • Effect of measurement units in attributes Smaller unit Larger variable range Larger effect to the clustering structure • Standardization + background knowledge • Clustering BB player may require giving more weightage to height

  22. Standardizing Variables • Standardize data • Calculate the mean absolute deviation: where • Calculate the standardized measurement (z-score) • Using mean absolute deviation is more robust than using standard deviation as z-scores of outliers do not become too small and so they remain detectable

  23. Similarity & dissimilarity between Objects

  24. Properties of Minkowski Distance

  25. Binary Variables • A contingency table for binary data • Simple matching coefficient (invariant, if the binary variable is symmetric): • Jaccard coefficient (noninvariant if the binary variable is asymmetric): Object j Object i

  26. Dissimilarity between Binary Variables • Example • gender is a symmetric attribute • the remaining attributes are asymmetric binary • let the values Y and P be set to 1, and the value N be set to 0

  27. Nominal Variables • A generalization of the binary variable in that it can take more than 2 states, e.g., red, yellow, blue, green • Method 1: Simple matching • m: # of matches, p: total # of variables • Method 2: use a large number of binary variables • creating a new binary variable for each of the M nominal states

  28. Ordinal Variables • An ordinal variable can be discrete or continuous • order is important, e.g., rank • Can be treated like interval-scaled • replacing xif by their rank • map the range of each variable onto [0, 1] by replacing i-th object in the f-th variable by • compute the dissimilarity using methods for interval-scaled variables

  29. Ratio-Scaled Variables • Ratio-scaled variable: a positive measurement on a nonlinear scale, approximately at exponential scale, such as AeBt or Ae-Bt • Methods: • treat them like interval-scaled variables — not a good choice! (why?) • apply logarithmic transformation yif = log(xif) • treat them as continuous ordinal data treat their rank as interval-scaled.

  30. Variables of Mixed Types • A database may contain all the six types of variables • symmetric binary, asymmetric binary, nominal, ordinal, interval and ratio. • One may use a weighted formula to combine their effects. • f is binary or nominal: dij(f) = 0 if xif = xjf , or dij(f) = 1 o.w. • f is interval-based: use the normalized distance • f is ordinal or ratio-scaled • compute ranks rif and • and treat zif as interval-scaled

  31. Similarity Measures If i = (xi1, xi2, …, xip,) and j = (xj1, xj2, …, xjp) are two p-dimensional data objects, then • Euclidean distance • Manhattan distance • Minkowski distance

  32. What Is Good Clustering? • A good clustering method will produce high quality clusters with • high intra-class similarity • low inter-class similarity • The quality of a clustering result depends on both the similarity measure used by the method and its implementation. • The quality of a clustering method is also measured by its ability to discover some or all of the hidden patterns.

  33. Impact of Outliers on Clustering

  34. Problems with Outliers • Many clustering algorithms take as input the number of clusters • Some clustering algorithms find and eliminate outliers • Statistical techniques to detect outliers • Discordancy Test • Not very realistic for real life data

  35. Clustering Problem • Given a database D={t1,t2,…,tn} of tuples and an integer value k, the Clustering Problem is to define a mapping f:Dg{1,..,k} where each ti is assigned to one cluster Kj, 1<=j<=k. • A Cluster, Kj, contains precisely those tuples mapped to it. • Unlike classification problem, clusters are not known a priori.

  36. Clustering Algorithms • K-means and its variants • Hierarchical clustering • Density-based clustering

  37. Clustering Hierarchical Partitional Density-based Grid-based Clustering Approaches

  38. Hierarchical Methods Creates a hierarchical decomposition of a given set of data objects • Agglomerative • Initially each item in its own cluster • Clusters are merged iteratively • Bottom up • Divisive • Initially all items in one cluster • Large clusters are divided successively • Top down

  39. Step 0 Step 1 Step 2 Step 3 Step 4 agglomerative (AGNES) a a b b a b c d e c c d e d d e e divisive (DIANA) Step 3 Step 2 Step 1 Step 0 Step 4 Hierarchical Clustering

  40. 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

  41. Partitioning Methods Given a DB of n objects, a partitioning method constructs k partitions of the data, where each partition represents a cluster and k<=n such that • Each group must contain atleast one object, and • Each object must belong to exactly one group

  42. Density-based Methods • Most partitioning-based methods cluster objects based on distances between them • Can find only spherical-shaped clusters • Density-based clustering • Continue growing a given cluster as long as the density in the ‘neighborhood’ exceeds some threshold.

  43. Agglomerative Clustering Algorithm • More popular hierarchical clustering technique • Basic algorithm is straightforward • 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

  44. Hierarchical Algorithms • Single Link (MIN) • MST Single Link • Complete Link (MAX) • Average Link (Group Average)

  45. Single Linkage Clustering • It is an example of agglomerative hierarchical clustering. • We consider the distance between one cluster and another cluster to be equal to the shortest distance from any member of one cluster to any member of the other cluster.

  46. Algorithm Given a set of N items to be clustered, and an NxN distance (or similarity) matrix, the basic process of single linkage clustering is as follows: 1.Start by assigning each item to its own cluster, so that if we have N items, we now have N clusters, each containing just one item. Let the distances (similarities) between the clusters equal the distances (similarities) between the items they contain. 2.Find the closest (most similar) pair of clusters and merge them into a single cluster, so that now you have one less cluster. 3.Compute distances (similarities) between the new cluster and each of the old clusters. 4.Repeat steps 2 and 3 until all items are clustered into a single cluster of size N.

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

  48. C1 C2 C3 C4 C5 C1 C2 C3 C4 C5 Intermediate Situation After some merging steps, we have some clusters C3 C4 C1 Proximity Matrix C5 C2

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

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

More Related