Presentation is loading. Please wait.

Presentation is loading. Please wait.

Clustering/Cluster Analysis. What is Cluster Analysis? l Finding groups of objects such that the objects in a group will be similar (or related) to one.

Similar presentations


Presentation on theme: "Clustering/Cluster Analysis. What is Cluster Analysis? l Finding groups of objects such that the objects in a group will be similar (or related) to one."— Presentation transcript:

1 Clustering/Cluster Analysis

2 What is Cluster Analysis? l 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 Applications of Cluster Analysis l Understanding –Group related documents for browsing, group genes and proteins that have similar functionality, group stocks with similar price fluctuations, or customers that have similar buying habits l Summarization –Reduce the size of large data sets Clustering precipitation in Australia

4 Notion of a Cluster can be Ambiguous How many clusters? Four ClustersTwo Clusters Six Clusters

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

6 Partitional Clustering Original Points A Partitional Clustering

7 Hierarchical Clustering Traditional Hierarchical ClusteringTraditional Dendrogram

8 Other Distinctions Between Sets of Clusters l Exclusive versus non-exclusive –In non-exclusive clusterings, points may belong to multiple clusters. –Can represent multiple classes or ‘border’ points l Fuzzy versus non-fuzzy –In fuzzy clustering, a point belongs to every cluster with some weight between 0 and 1 –Weights must sum to 1 –Probabilistic clustering has similar characteristics l Partial versus complete –In some cases, we only want to cluster some of the data

9 Types of Clusters l Well-separated clusters l Center-based clusters (our main emphasis) l Contiguous clusters l Density-based clusters l Described by an Objective Function

10 Types of Clusters: Well-Separated l Well-Separated Clusters: –A cluster is a set of points such that any point in a cluster is closer (or more similar) to every other point in the cluster than to any point not in the cluster. 3 well-separated clusters

11 Types of Clusters: Center-Based l Center-based – A cluster is a set of objects such that an object in a cluster is closer (more similar) to the “center” of a cluster, than to the center of any other cluster –The center of a cluster is often a centroid, the average of all the points in the cluster (assuming numerical attributes), or a medoid, the most “representative” point of a cluster (used if there are categorical features) 4 center-based clusters

12 Types of Clusters: Contiguity-Based l Contiguous Cluster (Nearest neighbor or Transitive) –A cluster is a set of points such that a point in a cluster is closer (or more similar) to one or more other points in the cluster than to any point not in the cluster. 8 contiguous clusters

13 Types of Clusters: Density-Based l Density-based –A cluster is a dense region of points, which is separated by low-density regions, from other regions of high density. –Used when the clusters are irregular or intertwined, and when noise and outliers are present. 6 density-based clusters

14 Types of Clusters: Objective Function l Clusters Defined by an Objective Function –Finds clusters that minimize or maximize an objective function. –Enumerate all possible ways of dividing the points into clusters and evaluate the `goodness' of each potential set of clusters by using the given objective function. (NP Hard) – Example: Sum of squares of distances to cluster center

15 Clustering Algorithms l K-means and its variants l Hierarchical clustering l Density-based clustering

16 K-means Clustering l Partitional clustering approach l Each cluster is associated with a centroid (center point) l Each point is assigned to the cluster with the closest centroid l Number of clusters, K, must be specified l The basic algorithm is very simple

17 K-means Clustering – Details l Initial centroids are often chosen randomly. –Clusters produced vary from one run to another. l The centroid is (typically) the mean of the points in the cluster. l ‘Closeness’ is measured by Euclidean distance, correlation, etc. l K-means will converge for common similarity measures mentioned above. l Most of the convergence happens in the first few iterations. –Often the stopping condition is changed to ‘Until relatively few points change clusters’

18 Evaluating K-means Clusters l Most common measure is Sum of Squared Error (SSE) –For each point, the error is the distance to the nearest cluster –To get SSE, we square these errors and sum them. –We can show that to minimize SSE the best update strategy is to use the center of the cluster. –Given two clusters, we can choose the one with the smallest error –One easy way to reduce SSE is to increase K, the number of clusters  A good clustering with smaller K can have a lower SSE than a poor clustering with higher K

19 Two different K-means Clusterings Sub-optimal ClusteringOptimal Clustering Original Points

20 Importance of Choosing Initial Centroids If you happen to choose good initial centroids, then you will get this after 6 iterations

21 Importance of Choosing Initial Centroids Good clustering

22 Importance of Choosing Initial Centroids … Bad Clustering

23 10 Clusters Example Starting with two initial centroids in one cluster of each pair of clusters

24 10 Clusters Example Starting with some pairs of clusters having three initial centroids, while other have only one.

25 Pre-processing and Post-processing l Pre-processing –Normalize the data –Eliminate outliers l Post-processing –Eliminate small clusters that may represent outliers –Split ‘loose’ clusters, i.e., clusters with relatively high SSE –Merge clusters that are ‘close’ and that have relatively low SSE

26 Limitations of K-means l K-means has problems when clusters are of differing –Sizes (biased toward the larger clusters) –Densities –Non-globular shapes l K-means has problems when the data contains outliers.

27 Limitations of K-means: Differing Sizes Original Points K-means (3 Clusters)

28 Limitations of K-means: Differing Density Original Points K-means (3 Clusters)

29 Limitations of K-means: Non-globular Shapes Original Points K-means (2 Clusters)

30 Overcoming K-means Limitations Original PointsK-means Clusters One solution is to use many clusters. Find parts of clusters, but need to put together.

31 Overcoming K-means Limitations Original PointsK-means Clusters

32 Overcoming K-means Limitations Original PointsK-means Clusters

33 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

34 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, …)

35 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 Agglomerative is most common

36 Starting Situation l Start with clusters of individual points

37 Intermediate Situation l After some merging steps, we have some clusters C1 C4 C2 C5 C3

38 Intermediate Situation l We want to merge the two closest clusters (C2 and C5) C1 C4 C2 C5 C3

39 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

40 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

41 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

42 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

43 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 

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

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

46 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

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

48 DBSCAN: Core, Border, and Noise Points

49 DBSCAN: Core, Border and Noise Points Original Points Point types: core, border and noise Eps = 10, MinPts = 4

50 When DBSCAN Works Well Original Points Clusters Resistant to Noise Can handle clusters of different shapes and sizes

51 When DBSCAN Does NOT Work Well Original Points (MinPts=4, Eps=9.75). (MinPts=4, Eps=9.92) Varying densities

52 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

53 Clusters found in Random Data Random Points K-means DBSCAN Complete Link

54 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

55 l SSE curve for a more complicated data set SSE of clusters found using K-means

56 “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 "Clustering/Cluster Analysis. What is Cluster Analysis? l Finding groups of objects such that the objects in a group will be similar (or related) to one."

Similar presentations


Ads by Google