Docsity

Unsupervised Learning: Organizing & Understanding Unlabeled Data with Clustering, Study notes of Computer Science

Partial preview of the text

Download Unsupervised Learning: Organizing & Understanding Unlabeled Data with Clustering and more Study notes Computer Science in PDF only on Docsity!

  • Lecture 15ClusteringOct – 31 –

Unsupervised learning and pattern discoveryUnsupervised

learning and pattern discovery

So far, our data has beenin this form:

We will be looking at unlabeled data:

x

1 ,x

1 , x 2

1 ,…, x 3

(^1) m

x

2 x

2

x

2

x^

2

(^1) y (^2) y

in this form:

x

1 ,x

1 , x 2

1 ,…, x 3

(^1) m

x

2 x

2

x

2

x^

2

unlabeled

data:

x^1

,x

, x

,…, xm (^) … …

y^

x

,x

, x

,…, xm (^) … …

x

n,x

n, x 2

n,…, x 3

nm

ny

x

n,x

n, x 2

n,…, x 3

nm

What do we expect to learn from such data? I have tons of data and need to:

organize it better – e.g., find subgroupsunderstand it better – e.g., understand interrelationshipsfind regular trends in it – e.g., If A and B, then C

Finding association patterns in data …

Dimension reduction for visualization

Clustering ExampleClustering

Example

Monthly spending

Monthly income

What is ClusteringWhat

is Clustering

  • In general clustering can be viewed as an

In general clustering can be viewed as anexploratory procedure for findinginteresting subgroups in given datainteresting subgroups in given data

  • Very commonly, we focus on a special

kind of clustering:kind of clustering:– Group

all

given examples into

disjoint

subsets

of

clusters such that:

subsets

of

clusters

, such that:

  • Examples within a cluster are (very) similar• Examples in different clusters are (very) different

Examples in different clusters are (very) different

Vector quantization for image

compression

127,292 bytes

701,554 bytes

Important components in clusteringImportant

components in clustering

  • Distance/similarity measure

Distance/similarity measure– How to measure the similarity between two

objects?

  • Clustering algorithm
    • How to find the clusters based on the

distance/similarity measures

  • Evaluation of results
    • How do we know that our clustering result is

good

Common distance/similarity measuresCommon

distance/similarity measures

-^

Euclidean distance

∑=

′ −

= ′^

d i

i

i^

x

x

L

1

2

2

)

(

) , (^

x x

-^

City block distance (Manhattan distance)

-^

Cosine similarity

-^

More flexible measures:

2

1

)

(

) , (^

i

d i

i i^

x x w

D

′ −

= ′^

x x

one can learn the appropriate weights given user guidance

Note: We can always transform between distance and similarity using aNote: We can always transform between distance and similarity using a

monotonically decreasing function

How to decide which to use?

-^

Usually need to consider the application domain, youneed to ask questions such as:– What does it mean for two consumers to be similar to each

other? Or for two genes to be similar to each other?

-^

Ideally we’d like to learn a distance ftn from user input– Ask users to provide things like object A is similar to object B,

dissimilar to object C

  • Learn a distance function to correctly reflect these relationships– This is a more advanced topic that we will not cover in this class,

but nonetheless important

-^

When we can not afford to learn a distance measure,and don’t have a clue about which distance function isappropriate, what should we do?

-^

Remember, clustering is an exploratory procedure and itRemember, clustering is an exploratory procedure and itis important to explore – i.e., try different options

Hierarchical and non-hierarchical

ClusteringClustering

-^

Hierarchical clustering

builds a tree-based hierarchical

taxonomy (

dendrogram

)^

i^

l

animal

vertebrate

invertebrate

fish reptile

L

mammal

worm

L

insect

-^

A non-hierarchical (flat) clustering

produces a single

partition of the unlabeled datap

-^

Choosing a particular level in the hierarchy produces aflat clustering

f f

-^

Recursive application of flat clustering can also producea hierarchical clustering.

Hierarchical Agglomerative Clustering

(^

C)

(HAC)

•^

Assumes a

distance function

for determining the

similarity of two instances.– One can also assume a similarity function, and

reverse many of the operations in the algorithm tomake it work for similarities St

t^

ith

h

bj

t i

t^

l^

t^

d

•^

Starts with each object in a separate cluster andthen repeatedly joins the two closest clustersuntil only one cluster is leftuntil only one cluster is left

-^

The history of merging forms a binary tree (or ahierarchy)hierarchy).

HAC AlgorithmHAC

Algorithm

St

t^

ith

ll

bj

t^

i^

th i

l^

t

St

art with all objects in their own cluster. Until there is only one cluster:

Among the current clusters determine the twoAmong the current clusters, determine the two

clusters,

c

and i

c

, that are closest j

Replace

c

and i

c

with a single cluster j

c

∪ i

c

j

Problem

: our distance function computes

distance between instances, but we also needto compute distance between clusters.to co

pute d sta ce bet

ee

c uste s

How?

Distance Between ClustersDistance

Between Clusters

•^

Assume a distance function that determinesthe distance of two objects:

D

( x

x

the

distance of two objects:

D

( x

, x

•^

There are multiple way to turn a distance

p

y

function into a cluster distance function:– Single Link: distance of two closest members of

clusters

  • Complete Link: distance of two furthest members of

clusters

  • Average Link: average distance

Average Link: average distance