• No results found

Data Mining Clustering (2) Sheets are based on the those provided by Tan, Steinbach, and Kumar. Introduction to Data Mining

N/A
N/A
Protected

Academic year: 2021

Share "Data Mining Clustering (2) Sheets are based on the those provided by Tan, Steinbach, and Kumar. Introduction to Data Mining"

Copied!
42
0
0

Loading.... (view fulltext now)

Full text

(1)

Data Mining Clustering (2)

Toon Calders

Toon Calders

(2)

Outline

Partitional Clustering

Distance-based

K-means, K-medoids, Bisecting K-means

Density-based

DBSCAN

DBSCAN

Hierarchical Clustering

Cluster validity

(3)

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

merges or splits

0.2 4

6

3 2 4

5

(4)

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

They may correspond to meaningful taxonomies

Example in biological sciences (e.g., animal kingdom,

phylogeny reconstruction, …)

(5)

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)

(6)

Agglomerative Clustering Algorithm

More popular hierarchical clustering technique

Basic algorithm is straightforward

1. Compute the proximity matrix 2. Let each data point be a cluster 3. Repeat

4. Merge the two closest clusters 4. Merge the two closest clusters 5. Update the proximity matrix 6. 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

(7)

Starting Situation

Start with clusters of individual points and a

proximity matrix

p1

p3 p4 p2

p1 p2 p3 p4 p5 . . .

p5 p4

. .

(8)

Intermediate Situation

After some merging steps, we have some clusters

C C

3

C2 C1

C1

C3 C4 C2

C3 C4 C5

C 1

C 4

C 2

C 5 3

C5

Proximity Matrix

(9)

Intermediate Situation

We want to merge the two closest clusters (C2 and C5) and update the proximity matrix.

C C

3

C2 C1

C1

C3 C4 C2

C3 C4 C5

C

C 4 3

Proximity Matrix

C5

(10)

After Merging

The question is “How do we update the proximity matrix?”

C C

3

? ? ? ?

?

? C2 U C5 C1

C1

C3 C2 U C5

C3 C4

C 1

C 4

C2 U C5

3

?

? C3

C4

Proximity Matrix

(11)

How to Define Inter-Cluster Similarity

p1

p3

p5 p4 p2

p1 p2 p3 p4 p5

. . .

Similarity?

 MIN p5

. . .

 MIN

 MAX

 Group Average

Distance Between Centroids Proximity Matrix

(12)

How to Define Inter-Cluster Similarity

p1

p3

p5 p4 p2

p1 p2 p3 p4 p5

. . .

 MIN p5

. .

.

Proximity Matrix

 MIN

 MAX

 Group Average

 Distance Between Centroids

 Other methods driven by an objective function

– Ward’s Method uses squared error

(13)

How to Define Inter-Cluster Similarity

p1

p3

p5 p4 p2

p1 p2 p3 p4 p5

. . .

 MIN p5

. .

.

Proximity Matrix

 MIN

 MAX

 Group Average

Distance Between Centroids

(14)

How to Define Inter-Cluster Similarity

p1

p3

p5 p4 p2

p1 p2 p3 p4 p5

. . .

 MIN p5

. .

.

Proximity Matrix

 MIN

 MAX

 Group Average

 Distance Between Centroids

 Other methods driven by an objective function

– Ward’s Method uses squared error

(15)

How to Define Inter-Cluster Similarity

p1

p3

p5 p4 p2

p1 p2 p3 p4 p5

. . .

 MIN

× ×

p5

. .

.

Proximity Matrix

 MIN

 MAX

 Group Average

Distance Between Centroids

(16)

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

(17)

Hierarchical Clustering: MIN

1

2

3 5

6 1

2

3

5

0.15 0.2

3

4 2 6

4

0

0.05 0.1

(18)

Strength of MIN

Original Points Two Clusters

• Can handle non-elliptical shapes

(19)

Limitations of MIN

(20)

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

(21)

Hierarchical Clustering: MAX

0.2 0.25 0.3 0.35 0.4

1

2

3 5

6

2 5

4

0.05 0.1 0.15

3

0.2

4

6

3 1

(22)

Strength of MAX

Original Points Two Clusters

• Less susceptible to noise and outliers

(23)

Limitations of MAX

(24)

Cluster Similarity: Group Average

Proximity of two clusters is the average of pairwise proximity between points in the two clusters.

Need to use average connectivity for scalability since total

|

|Cluster

|

|Cluster

) p , p proximity(

) Cluster ,

Cluster proximity(

j i

Cluster p

Cluster p

j i

j i

j j

i i

= ∗

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

(25)

Hierarchical Clustering: Group Average

0.15 0.2 0.25

1

2

3 5

2

5 4

0 0.05 0.1

3

4

6

1

(26)

Hierarchical Clustering: Group Average

Compromise between Single and Complete Link

Strengths

Strengths

Less susceptible to noise and outliers

Limitations

Biased towards globular clusters

(27)

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

(28)

Hierarchical Clustering: Comparison

MIN MAX

1

2

3 4 5

6 1

2 5

3 1 4

2

3 4 5

6 1 2

3

4

5

Group Average

Ward’s Method

1 2

3 4 5

6 1 2

5

3 1 4

2

3 4 5

6 1 2

5

3 4

4 4

(29)

Hierarchical Clustering: Time and Space requirements

O(N

2

) space since it uses the proximity matrix.

N is the number of points.

O(N

3

) time in many cases

There are N steps and at each step the size, N

2

,

There are N steps and at each step the size, N

2

, proximity matrix must be updated and searched

Complexity can be reduced to O(N

2

log(N) ) time for

(30)

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

(31)

Outline

Partitional Clustering

Distance-based

K-means, K-medoids, Bisecting K-means

Density-based

DBSCAN

DBSCAN

Hierarchical Clustering

(32)

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?

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

(33)

Clusters found in Random Data

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

y

Random Points

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

y

DBSCAN

0 0.2 0.4 0.6 0.8 1

0

x

0.5 0.6 0.7 0.8 0.9 1

y

K-

means

0 0.2 0.4 0.6 0.8 1

0

x

0.5 0.6 0.7 0.8 0.9 1

y

Complete

Link

(34)

1. Determining the clustering tendency of a set of data, i.e.,

distinguishing whether non-random structure actually exists in the data.

2. Comparing the results of a cluster analysis to externally known results, e.g., to externally given class labels.

3. Evaluating how well the results of a cluster analysis fit the data

Different Aspects of Cluster Validation

3. Evaluating how well the results of a cluster analysis fit the data without reference to external information.

- Use only the data

4. Comparing the results of two different sets of cluster analyses to determine which is better.

5. Determining the ‘correct’ number of clusters.

(35)

Measuring Cluster Validity Via Correlation

Correlation of incidence and proximity matrices for the K-means clusterings of the following two data sets.

0.8 0.9 1

0.8 0.9 1

0.2 0.3 0.4 0.5 0.6 0.7

y

0.2 0.3 0.4 0.5 0.6 0.7

y

(36)

Order the similarity matrix with respect to cluster labels and inspect visually.

Using Similarity Matrix for Cluster Validation

0.8 0.9 1

10 20

30 0.7

0.8 0.9 1

0 0.2 0.4 0.6 0.8 1

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7

x

y

Points

Points

20 40 60 80 100

30 40 50 60 70 80 90

100

Similarity0 0.1 0.2 0.3 0.4 0.5 0.6 0.7

(37)

Using Similarity Matrix for Cluster Validation

Clusters in random data are not so crisp

Points

10 20 30 40

50 0.5

0.6 0.7 0.8 0.9 1

0.5 0.6 0.7 0.8 0.9 1

y

Points

50 60 70 80

90 0.1

0.2 0.3 0.4 0.5

0.1 0.2 0.3 0.4

y0.5

(38)

Points

10 20 30 40

50 0.5

0.6 0.7 0.8 0.9 1

Using Similarity Matrix for Cluster Validation

Clusters in random data are not so crisp

0.5 0.6 0.7 0.8 0.9 1

y

Points

Points

20 40 60 80 100

60 70 80 90

100

Similarity0 0.1 0.2 0.3 0.4

K-means

0 0.2 0.4 0.6 0.8 1

0 0.1 0.2 0.3 0.4

x

(39)

Using Similarity Matrix for Cluster Validation

Clusters in random data are not so crisp

0.5 0.6 0.7 0.8 0.9 1

y

Points

10 20 30 40

50 0.5

0.6 0.7 0.8 0.9 1

0.1 0.2 0.3 0.4

y0.5

Points

50 60 70 80

90 0.1

0.2 0.3 0.4 0.5

(40)

Using Similarity Matrix for Cluster Validation

1

2

3 6

4

0.4 0.5 0.6 0.7 0.8 0.9 1

500

1000

1500

5

7

DBSCAN

0 0.1 0.2 0.3 0.4

500 1000 1500 2000 2500 3000

2000

2500

3000

(41)

Conclusions

Partitional algorithms

K-means and its variations

Restricted to spherical clusters

Number of clusters needs to be set by user DBSCAN

DBSCAN

Any shape of cluster

Works only if density is uniform

Two parameters to set …

Hierarchical

(42)

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.

Final Comment on Cluster Validity

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

References

Related documents

3 .Various Clustering Algorithms Hierarchical Methods  Agglomerative algorithms  Divisive Algorithms Partitioning Methods  Relocation Algorithms  Probabilistic Clustering

With respect to the three clustering paradigms adopted to demonstrate the proposed MABC framework: K -means, K -NN and divisive hierarchical clustering, all require users to

Firstly, two-layer K-means algorithm adopts the data normalization step and the initial cluster center step and then cluster data set S into K clusters using traditional

The algorithm start with every point as a individual cluster and based on distance function the two minimum distance function are merge in single cluster also call

● Each point is assigned to the cluster with the closest centroid ● Number of clusters, K, must be specified.. ● The basic algorithm is

As part of procedure Simple k-means algorithm is used for clustering the entire dataset into 3 clusters i.e., cluster-0 - for gestational diabetes, cluster-1 for type-1

Bottom-Up (agglomerative): Starting with each item in its own cluster, find the best pair to merge into a new cluster. Repeat until all clusters are fused

The clusters with the closest pair of representative points are the clusters that are merged at each step of CURE’s hierarchical clustering algorithm.. The