Docsity

Lecture Notes on Clustering - Machine Learning | CS 5350, Study notes of Computer Science

Toggle sidebar
bg1
Machine Learning (CS 5350/CS 6350) 4 Mar 2008
Clustering
Now begins our foray into unsupervised learning. Most unsupervised learning problems deal only with input
data, typically considered as a matrix X∈RN×Dover Ndata points and Ddimensions. There are no
labels.
Clustering is the problem of grouping data according to similarity.
Typically one uses a distance metric to judge similarity (though this is not always required). A metric d
must satisfy:
•d(x, y) = 0 iff x=y– isolation
•d(x, y) = d(y, x) – distance is symmetric
•d(x, y) + d(y, z )≥d(x, z) – triangle inequality
If (1) doesn’t hold, it is a pseudo-metric.
All of our favorite norms are metrics. Non-real metrics include things like string edit distance.
Basically two types of clustering:
•Hierarchical
•Flat
Hierarchical tries to build a tree over the data (Nleaves). Typically binary. Flat just tries to find Kclusters
of the data.
Hierarchical Clustering
Bottom-up strategy:
•Put every element into its own cluster
•Merge two most closest clusters
•If >1 cluster exists, go to (2)
How to measure “closest.” For individual data points, just use the metric d. What about d({x1, x2},{x3, x4, x5})?
•Min-link (aka “single link”):
d(R, S) = min
xR∈R,xS∈Sd(xR, xS)
•Max-link (aka “complete”):
d(R, S) = max
xR∈R,xS∈Sd(xR, xS)
•Average-link:
d(R, S) = 1
|R| |S|X
xR∈R,xS∈S
d(xR, xS)
1
pf3

Partial preview of the text

Download Lecture Notes on Clustering - Machine Learning | CS 5350 and more Study notes Computer Science in PDF only on Docsity!

Machine Learning (CS 5350/CS 6350) 4 Mar 2008

Clustering

Now begins our foray into unsupervised learning. Most unsupervised learning problems deal only with input data, typically considered as a matrix X ∈ RN^ ×D^ over N data points and D dimensions. There are no labels.

Clustering is the problem of grouping data according to similarity.

Typically one uses a distance metric to judge similarity (though this is not always required). A metric d must satisfy:

  • d(x, y) = 0 iff x = y – isolation
  • d(x, y) = d(y, x) – distance is symmetric
  • d(x, y) + d(y, z) ≥ d(x, z) – triangle inequality

If (1) doesn’t hold, it is a pseudo-metric.

All of our favorite norms are metrics. Non-real metrics include things like string edit distance.

Basically two types of clustering:

  • Hierarchical
  • Flat

Hierarchical tries to build a tree over the data (N leaves). Typically binary. Flat just tries to find K clusters of the data.

Hierarchical Clustering

Bottom-up strategy:

  • Put every element into its own cluster
  • Merge two most closest clusters
  • If > 1 cluster exists, go to (2)

How to measure “closest.” For individual data points, just use the metric d. What about d({x 1 , x 2 }, {x 3 , x 4 , x 5 })?

  • Min-link (aka “single link”): d(R, S) = min xR∈R,xS ∈S d(xR, xS )
  • Max-link (aka “complete”): d(R, S) = max xR∈R,xS ∈S

d(xR, xS )

  • Average-link: d(R, S) =

|R| |S|

xR∈R,xS ∈S

d(xR, xS )

Machine Learning (CS 5350/CS 6350) 2

These have very different properties. Min-link results in chaining. Max-link results in very “round” clusters. Average-link is an intermediary.

Top-down strategy:

  • Put every element into a single cluster
  • Remove the “outsider” (or outsiders) from the group
  • If a cluster of size > 1 exists, go to (2)

Same story as bottom up with linkage. Here, if we remove a single element, we get a funny tree. If we want to split clusters in half, it can be very computationally expensive. Typically bottom-up is prefered.

Flat Clustering

Want to break N elements into K groups. How to choose the groups?

  • Want high intercluster similarity:

k

n 6 =m∈k d(xn, xm) should be low.

  • Want low intracluster similarity:

k 6 =k′

n∈k

m∈k′^ d(xn, xm) should be high.

Too hard to optimize a linear combination of these... there are (^) K^1!

k(−1) K−k(K k

kN^ possible clusters (for N = 19, K = 4, this is over 10^10.

Idea: propose clusters, then iteratively fix errors.

  • Initialize cluster centers
  • Assign each data point to the closest center
  • Recompute the centers as the means of the data points
  • If assignments have changed, go to (2)

This is the k-means algorithm. It is highly sensitive to initialization, but converges quite quickly. (There are various ways to speed it up, as well.)

Initializing means:

  • Random points drawn from a “reasonable” input space
  • Random data points
  • First a random data point, then a second data point as far away as possible, then a third data point again as far away as possible, etc.

In general, it’s a good idea to do a few runs of k-means.

k-mediods is similar, but forces each centroid to be a data point. This is advantageous for non-real-valued data.