Presentation is loading. Please wait.

Presentation is loading. Please wait.

Data Mining: cluster analysis

Similar presentations


Presentation on theme: "Data Mining: cluster analysis"— Presentation transcript:

1 Data Mining: cluster analysis
Instructor: Dr. Chun Yu School of Statistics Jiangxi University of Finance and Economics

2 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 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

4 Supervised Classification and Unsupervised Classification
Cluster analysis is related to other techniques that are used to divide data objects into groups. Supervised classification Classification New, unlabeled objects are assigned a class label using a model developed from objects with known class label Unsupervised classification Cluster analysis

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

6 Types of Clusterings A clustering is a set of clusters
Important distinction between hierarchical and partitional sets 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

7 Partitional Clustering
A Partitional Clustering Original Points

8 Hierarchical Clustering

9 Other Distinctions Between Sets of Clusters
Exclusive versus non-exclusive In non-exclusive clusterings, points may belong to multiple clusters. Can represent multiple classes 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 Partial versus complete In some cases, we only want to cluster some of the data

10 Types of Clusters Well-separated clusters Center-based clusters
Contiguous clusters Density-based clusters Shared-Property or Conceptual

11 Types of Clusters: Well-Separated
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

12 Types of Clusters: 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, or a medoid, the most “representative” point of a cluster 4 center-based clusters

13 Types of Clusters: Contiguity-Based
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

14 Types of Clusters: 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 intertwinded, and when noise and outliers are present. 6 density-based clusters

15 Types of Clusters: Conceptual Clusters
Shared Property or Conceptual Clusters Finds clusters that share some common property or represent a particular concept. 2 Overlapping Circles

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

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

18 Using K-Means Algorithm to Find 3 Clusters

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

20 Evaluating K-means Clusters
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. x is a data point in cluster Ci and ci is the centroid for cluster Ci dist is the standard Euclidean (L2) distance between two objects

21 Table of Notation Symbol Description x Ci ci c mi m K An object
The ith cluster The centroid of the ith cluster The centroid of all points The number of objects in the ith cluster The number of object in the data set The number of clusters

22 The Centroid of a cluster
It can be shown that the centroid that minimizes the SSE of the cluster is the mean The centroid (mean) of the ith cluster is defined by the equation below: 𝑐 𝑖 = 1 𝑚 𝑖 𝑥∈ 𝐶 𝑖 𝑥 For example, a cluster contains three two-dimensional points: (1,1), (2,3) and (6,2), the centroid of the cluster is: ((1+2+6)/3, (1+3+2)/3) = (3,2)

23 Two different K-means Clusterings
Original Points Optimal Clustering Sub-optimal Clustering

24 Importance of Choosing Initial Centroids

25 Importance of Choosing Initial Centroids …

26 Solutions to Initial Centroids Problem
Multiple runs Helps, but probability is not on your side Sample and use hierarchical clustering to determine initial centroids Select more than k initial centroids and then select among these initial centroids Select most widely separated Postprocessing Bisecting K-means

27 Handling Empty Clusters
Basic K-means algorithm can yield empty clusters Several strategies Choose the point that contributes most to SSE Choose a point from the cluster with the highest SSE If there are several empty clusters, the above can be repeated several times.

28 Pre-processing and Post-processing
Normalize the data Eliminate outliers 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

29 Bisecting K-means Bisecting K-means algorithm
Variant of K-means that can produce a partitional or a hierarchical clustering

30 Bisecting K-means Example

31 Limitations of K-means
K-means has problems when clusters are of differing Sizes Densities Non-globular shapes K-means has problems when the data contains outliers.

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

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

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

35 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

36 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, entomological taxonomy, …)

37 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

38 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

39 How to Define Inter-Cluster Similarity
p1 p3 p5 p4 p2 . . . . Similarity? MIN MAX Group Average Distance Between Centroids 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 . . . . MIN MAX Group Average Distance Between Centroids Other methods driven by an objective function Ward’s Method uses squared error Proximity Matrix

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

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

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

44 Specific Techniques Sample data

45 Sample data: Euclidean Distance Matrix

46 Cluster Similarity: MIN or Single Link
Similarity of two clusters is based on the two most similar (closest) points in the different clusters The proximity of two clusters is defined as the minimum of the distance (maximum of the similarity) Dendrogram: if you start with all points as singleton clusters and add links between points one at a time, shortest links first, then these single links combine the points into clusters

47 Hierarchical Clustering: MIN
Points 6 and 3 are merged first, then points 5 and 2 The distance between clusters {3,6} and {2,5} is given by dist({3,6},{2,5}) = min(dist(3,2),dist(6,2),dist(3,5),dist(6,5)) = min(0.15,0.25,0.28,0.39) = 0.15

48 Hierarchical Clustering: MIN
5 1 2 3 4 5 6 4 3 2 1 Nested Clusters Dendrogram

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

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

51 Cluster Similarity: MAX or Complete Linkage
Similarity of two clusters is based on the two least similar (most distant) points in the different clusters Dendrogram: we start with all points as singleton clusters and add links between points one at a time, shortest links first, then a group of points is not a cluster until all the points in it are completely linked

52 Hierarchical Clustering: MAX
As with single link, points 6 and 3 are merged first. However, {3,6} is merged with {4}, instead of {2,5} or {1} dist({3,6},{4}) = max(dist(3,4),dist(6,4)) = max(0.15,0.22) = 0.22

53 Hierarchical Clustering: MAX
dist({3,6},{2,5}) = max(dist(3,2),dist(6,2),dist(3,5),dist(6,5)) = max(0.15,0.25,0.28,0.39) = 0.39 dist({3,6},{1}) = max(dist(3,1),dist(6,1)) = max(0.22,0.23) = 0.23

54 Hierarchical Clustering: MAX
5 4 1 2 3 4 5 6 2 3 1 Nested Clusters Dendrogram

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

56 Limitations of MAX Two Clusters Original Points
Tends to break large clusters

57 Cluster Similarity: Group Average
Proximity of two clusters is the average of pairwise proximity between points in the two clusters. dist({3,6,4},{1}) = ( )/(3*1) = 0.28 dist({2,5},{1}) =( )/(2*1) =0.29

58 Cluster Similarity: Group Average
dist({3,6,4},{2,5}) = ( )/(3*2) = 0.26 Because dist({3,6,4},{2,5}) is smaller than dist({3,6,4},{1}) and dist({2,5},{1}), clusters {3,6,4} and {2,5} are merged at the fourth stage

59 Hierarchical Clustering: Group Average
5 4 1 2 3 4 5 6 2 3 1 Nested Clusters Dendrogram

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

61 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

62 Hierarchical Clustering: Comparison
5 5 1 2 3 4 5 6 4 4 1 2 3 4 5 6 3 2 2 1 MIN MAX 3 1 5 5 1 2 3 4 5 6 1 2 3 4 5 6 4 4 2 2 Ward’s Method 3 3 1 Group Average 1

63 Determining the correct number of clusters
We can try to find the natural number of clusters in a data set by looking for the number of clusters at which there is a knee in the plot of the evaluation measure when it is plotted against the number of clusters.

64 Hierarchical Clustering: Problems and Limitations
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

65 DBSCAN DBSCAN is a density-based algorithm. Center-based density
Density = number of points within a specified radius (Eps)

66 DBSCAN 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.

67 DBSCAN: Core, Border, and Noise Points

68 DBSCAN Algorithm Any two core points that are close enough (within a distance Eps of one another) are put in the same cluster Any border point that is close enough to a core point is put in the same cluster as the core point

69 DBSCAN: Determining EPS and MinPts
Idea is that for points in a cluster, their kth nearest neighbors are at roughly the same distance (called k-dist) Noise points have the kth nearest neighbor at farther distance So, plot sorted distance of every point to its kth nearest neighbor

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

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

72 When DBSCAN Does NOT Work Well
Varying densities High-dimensional data

73 Thank you!


Download ppt "Data Mining: cluster analysis"

Similar presentations


Ads by Google