31
1 1 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

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

  • View
    213

  • Download
    0

Embed Size (px)

Citation preview

Page 1: 1 1 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

1 1

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

Page 2: 1 1 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

2 2

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

Discovered Clusters Industry Group

1 Applied-Matl-DOWN,Bay-Network-Down,3-COM-DOWN,

Cabletron-Sys-DOWN,CISCO-DOWN,HP-DOWN, DSC-Comm-DOWN,INTEL-DOWN,LSI-Logic-DOWN,

Micron-Tech-DOWN,Texas-Inst-Down,Tellabs-Inc-Down, Natl-Semiconduct-DOWN,Oracl-DOWN,SGI-DOWN,

Sun-DOWN

Technology1-DOWN

2 Apple-Comp-DOWN,Autodesk-DOWN,DEC-DOWN,

ADV-Micro-Device-DOWN,Andrew-Corp-DOWN, Computer-Assoc-DOWN,Circuit-City-DOWN,

Compaq-DOWN, EMC-Corp-DOWN, Gen-Inst-DOWN, Motorola-DOWN,Microsoft-DOWN,Scientific-Atl-DOWN

Technology2-DOWN

3 Fannie-Mae-DOWN,Fed-Home-Loan-DOWN, MBNA-Corp-DOWN,Morgan-Stanley-DOWN

Financial-DOWN

4 Baker-Hughes-UP,Dresser-Inds-UP,Halliburton-HLD-UP,

Louisiana-Land-UP,Phillips-Petro-UP,Unocal-UP, Schlumberger-UP

Oil-UP

Clustering precipitation in Australia

Page 3: 1 1 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

3 3

Notion of a Cluster can be Ambiguous

How many clusters?

Four Clusters Two Clusters

Six Clusters

Page 4: 1 1 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

4 4

Types of Clusterings

A clustering is a set of clusters

Important distinction between hierarchical and partitional sets of clusters

Partitional Clustering– A division of 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

Page 5: 1 1 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

5 5

Partitional vs Hierarchical Clustering

Original Points A Partitional Clustering

p4 p1

p3

p2

p4p1 p2 p3

Hierarchical Clustering Dendrogram

Page 6: 1 1 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

6 6

Other Distinctions Between Sets of Clusters

Exclusive versus Overlapping versus Fuzzy– Exclusive: each object is assigned to only one cluster

– Overlapping: an object may belong to more than one cluster

– Fuzzy: every object belongs to every cluster, with a weight between 0 (absolutely doesn’t belong) and 1 (absolutely belongs)

Partial versus complete– Complete clustering: assigns every object to a cluster

– Partial clustering: does not have to assign every object to some clusters

Page 7: 1 1 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

7 7

K-means Clustering

Partitional clustering approach Each cluster is associated with a centroid (center) Number of clusters, K, must be specified

Page 8: 1 1 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

8 8

Illustrating K-means

-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

0

0.5

1

1.5

2

2.5

3

x

y

Iteration 1

-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

0

0.5

1

1.5

2

2.5

3

x

y

Iteration 2

-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

0

0.5

1

1.5

2

2.5

3

x

y

Iteration 3

-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

0

0.5

1

1.5

2

2.5

3

x

y

Iteration 4

-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

0

0.5

1

1.5

2

2.5

3

x

y

Iteration 5

-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

0

0.5

1

1.5

2

2.5

3

x

y

Iteration 6

Page 9: 1 1 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

9 9

Illustrating K-means

-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

0

0.5

1

1.5

2

2.5

3

x

y

Iteration 1

-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

0

0.5

1

1.5

2

2.5

3

x

y

Iteration 2

-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

0

0.5

1

1.5

2

2.5

3

x

y

Iteration 3

-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

0

0.5

1

1.5

2

2.5

3

x

y

Iteration 4

-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

0

0.5

1

1.5

2

2.5

3

x

y

Iteration 5

-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

0

0.5

1

1.5

2

2.5

3

x

y

Iteration 6

Page 10: 1 1 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

10 10

K-means Clustering – Details

Initial centroids are often chosen randomly.– Clusters produced vary from one run to another.

‘Closeness’ is measured by a proximity measure– e.g., Euclidean distance, cosine similarity, or

correlation K-means will converge for common proximity

measures mentioned above.– Most of the convergence happens in the first few

iterations. Complexity is O( n * K * I * d )

– n = number of points, K = number of clusters, I = number of iterations, d = number of attributes

Page 11: 1 1 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

11 11

K-means as Optimization Problem

k-means clustering can be viewed as an iterative approach for minimizing sum of squared error (SSE)

– x: a data point in cluster Ci

– i is the representative point for cluster Ci

For SSE, we can show that i corresponds to center of the cluster

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

K

i Cxi

i

xSSE1

2

Page 12: 1 1 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

12 12

Two different K-means Clusterings

-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

0

0.5

1

1.5

2

2.5

3

x

y

-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

0

0.5

1

1.5

2

2.5

3

x

y

Sub-optimal Clustering

-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

0

0.5

1

1.5

2

2.5

3

x

y

Optimal Clustering

Original Points

Page 13: 1 1 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

13 13

Importance of Choosing Initial Centroids …

-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

0

0.5

1

1.5

2

2.5

3

x

y

Iteration 1

-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

0

0.5

1

1.5

2

2.5

3

x

y

Iteration 2

-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

0

0.5

1

1.5

2

2.5

3

x

y

Iteration 3

-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

0

0.5

1

1.5

2

2.5

3

x

y

Iteration 4

-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

0

0.5

1

1.5

2

2.5

3

x

y

Iteration 5

Page 14: 1 1 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

14 14

Importance of Choosing Initial Centroids …

-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

0

0.5

1

1.5

2

2.5

3

x

y

Iteration 1

-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

0

0.5

1

1.5

2

2.5

3

x

y

Iteration 2

-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

0

0.5

1

1.5

2

2.5

3

x

y

Iteration 3

-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

0

0.5

1

1.5

2

2.5

3

x

y

Iteration 4

-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

0

0.5

1

1.5

2

2.5

3

xy

Iteration 5

Page 15: 1 1 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

15 15

10 Clusters Example

0 5 10 15 20

-6

-4

-2

0

2

4

6

8

x

yIteration 1

0 5 10 15 20

-6

-4

-2

0

2

4

6

8

x

yIteration 2

0 5 10 15 20

-6

-4

-2

0

2

4

6

8

x

yIteration 3

0 5 10 15 20

-6

-4

-2

0

2

4

6

8

x

yIteration 4

Starting with two initial centroids in one cluster of each pair of clusters

Page 16: 1 1 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

16 16

10 Clusters Example

0 5 10 15 20

-6

-4

-2

0

2

4

6

8

x

y

Iteration 1

0 5 10 15 20

-6

-4

-2

0

2

4

6

8

x

y

Iteration 2

0 5 10 15 20

-6

-4

-2

0

2

4

6

8

x

y

Iteration 3

0 5 10 15 20

-6

-4

-2

0

2

4

6

8

x

y

Iteration 4

Starting with two initial centroids in one cluster of each pair of clusters

Page 17: 1 1 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

17 17

10 Clusters Example

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

0 5 10 15 20

-6

-4

-2

0

2

4

6

8

x

y

Iteration 1

0 5 10 15 20

-6

-4

-2

0

2

4

6

8

x

y

Iteration 2

0 5 10 15 20

-6

-4

-2

0

2

4

6

8

x

y

Iteration 3

0 5 10 15 20

-6

-4

-2

0

2

4

6

8

x

y

Iteration 4

Page 18: 1 1 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

18 18

10 Clusters Example

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

0 5 10 15 20

-6

-4

-2

0

2

4

6

8

x

yIteration 1

0 5 10 15 20

-6

-4

-2

0

2

4

6

8

x

y

Iteration 2

0 5 10 15 20

-6

-4

-2

0

2

4

6

8

x

y

Iteration 3

0 5 10 15 20

-6

-4

-2

0

2

4

6

8

x

y

Iteration 4

Page 19: 1 1 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

19 19

Solutions to Initial Centroids Problem

Multiple runs– Helps, but probability might not be 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 the most widely separated centroids

Postprocessing

Bisecting K-means

Page 20: 1 1 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

20 20

Empty Clusters

K-means can yield empty clusters

6.5 9 10 15 16 18.5X X X

7.75 12.5 17.25

6.5 9 10 15 16 18.5X X X6.8 13 18

Empty Cluster

Page 21: 1 1 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

21 21

Handling Empty Clusters

Choose a new centroid to replace the empty cluster

Several strategies– Choose the point that contributes most to SSE

this corresponds to the point that is farthest away from any of the current centroids

– Choose a point from the cluster with the highest SSE This will split the cluster and reduces the overall SSE

Page 22: 1 1 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

22 22

Pre-processing and Post-processing

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

Page 23: 1 1 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

23 23

Bisecting K-means

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

clustering

Page 24: 1 1 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

24 24

Bisecting K-means Example

Page 25: 1 1 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

25 25

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.

Page 26: 1 1 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

26 26

Limitations of K-means: Differing Sizes

Original Points K-means (3 Clusters)

Page 27: 1 1 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

27 27

Limitations of K-means: Differing Density

Original Points K-means (3 Clusters)

Page 28: 1 1 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

28 28

Limitations of K-means: Non-globular Shapes

Original Points K-means (2 Clusters)

Page 29: 1 1 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

29 29

Overcoming K-means Limitations

Original Points K-means Clusters

One solution is to use many clusters.Find parts of clusters, but need to put together.

Page 30: 1 1 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

30 30

Overcoming K-means Limitations

Original Points K-means Clusters

Page 31: 1 1 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

31 31

Overcoming K-means Limitations

Original Points K-means Clusters