Machine Learning : Clustering, Self-Organizing Mapsds24/lehre/ml_ws_2013/ml_09_clust.pdf ·...

15
Machine Learning Clustering, Self-Organizing Maps Machine Learning : Clustering, Self-Organizing Maps 12/12/2013

Transcript of Machine Learning : Clustering, Self-Organizing Mapsds24/lehre/ml_ws_2013/ml_09_clust.pdf ·...

Page 1: Machine Learning : Clustering, Self-Organizing Mapsds24/lehre/ml_ws_2013/ml_09_clust.pdf · Clustering 12/12/2013 Machine Learning : Clustering, Self-Organizing Maps 2 The task: partition

Machine Learning

Clustering, Self-Organizing Maps

Machine Learning : Clustering, Self-Organizing Maps12/12/2013

Page 2: Machine Learning : Clustering, Self-Organizing Mapsds24/lehre/ml_ws_2013/ml_09_clust.pdf · Clustering 12/12/2013 Machine Learning : Clustering, Self-Organizing Maps 2 The task: partition

Clustering

12/12/2013 Machine Learning : Clustering, Self-Organizing Maps 2

The task: partition a set of objects into “meaningful” subsets (clusters). The objects in a subset should be “similar”.

Notations:

Set of Clusters

Set of indices

Feature vectors

Partitioning

for ,

Page 3: Machine Learning : Clustering, Self-Organizing Mapsds24/lehre/ml_ws_2013/ml_09_clust.pdf · Clustering 12/12/2013 Machine Learning : Clustering, Self-Organizing Maps 2 The task: partition

Clustering

12/12/2013 Machine Learning : Clustering, Self-Organizing Maps 3

Let and each cluster has a “representative”

The task reads:

Alternative variant is to consider the clustering asa mapping that assigns a cluster number to each

Page 4: Machine Learning : Clustering, Self-Organizing Mapsds24/lehre/ml_ws_2013/ml_09_clust.pdf · Clustering 12/12/2013 Machine Learning : Clustering, Self-Organizing Maps 2 The task: partition

K-Means Algorithm

12/12/2013 Machine Learning : Clustering, Self-Organizing Maps 4

Initialize centers randomly,

Repeat until convergence:

1. Classify:

2. Update centers:

• The task is NP• converges to a local optimum (depends on the initialization)

Page 5: Machine Learning : Clustering, Self-Organizing Mapsds24/lehre/ml_ws_2013/ml_09_clust.pdf · Clustering 12/12/2013 Machine Learning : Clustering, Self-Organizing Maps 2 The task: partition

Sequential K-Means

12/12/2013 Machine Learning : Clustering, Self-Organizing Maps 5

Repeat infinitely:

1. Chose randomly a feature vector from the training data

2. Classify it:

3. Update the -th center:

with a decreasing step

• converges to the same, as the parallel version• is a special case of Robbins-Monro Algorithm

Page 6: Machine Learning : Clustering, Self-Organizing Mapsds24/lehre/ml_ws_2013/ml_09_clust.pdf · Clustering 12/12/2013 Machine Learning : Clustering, Self-Organizing Maps 2 The task: partition

Some variants

12/12/2013 Machine Learning : Clustering, Self-Organizing Maps 6

Other distances, e.g. instead of

In the K-Means algorithm the classification step remains the same,the update step – the geometric median of

(a bit complicated as the average ).

Another problem: features may be not additive ( does not exist)

Solution: K-Medioid Algorithm ( is a feature vector from the training set)

Page 7: Machine Learning : Clustering, Self-Organizing Mapsds24/lehre/ml_ws_2013/ml_09_clust.pdf · Clustering 12/12/2013 Machine Learning : Clustering, Self-Organizing Maps 2 The task: partition

A generalization

12/12/2013 Machine Learning : Clustering, Self-Organizing Maps 7

Observe (for the Euclidean distance):

In what follows:

with a Distance Matrix that can be defined in very different ways.

Example: Objects are nodes of a weighted graph, is the length of the shortest path from to .

Distances for “other” objects (non-vectors):• Edit (Levenshtein) distance between two symbolic sequences• For graphs – distances based on graph isomorphism etc.

Page 8: Machine Learning : Clustering, Self-Organizing Mapsds24/lehre/ml_ws_2013/ml_09_clust.pdf · Clustering 12/12/2013 Machine Learning : Clustering, Self-Organizing Maps 2 The task: partition

An application – color reduction

12/12/2013 Machine Learning : Clustering, Self-Organizing Maps 8

Objects are pixels, features are RGB-values.Partition the RGB-space into “characteristic” colors.

(8 colors)

Page 9: Machine Learning : Clustering, Self-Organizing Mapsds24/lehre/ml_ws_2013/ml_09_clust.pdf · Clustering 12/12/2013 Machine Learning : Clustering, Self-Organizing Maps 2 The task: partition

Another application – superpixel segmentation

Object are pixels. Features are RGBXY-values.

→ Those pixels belong to the same cluster that are close to each other both spatially and in in the RGB-space

SLIC Superpixels: http://ivrg.epfl.ch/research/superpixels

12/12/2013 Machine Learning : Clustering, Self-Organizing Maps 9

Page 10: Machine Learning : Clustering, Self-Organizing Mapsds24/lehre/ml_ws_2013/ml_09_clust.pdf · Clustering 12/12/2013 Machine Learning : Clustering, Self-Organizing Maps 2 The task: partition

Cohonen Networks, Self-Organizing Maps

12/12/2013 Machine Learning : Clustering, Self-Organizing Maps 10

The task is to “approximate” a dataset by a neural network of a certain topology.

An example – stereo in “flatland”.

The input space is 3- (or more) dimensional, the set of points is however isomorphic to a 2D-space (up to noises).

Page 11: Machine Learning : Clustering, Self-Organizing Mapsds24/lehre/ml_ws_2013/ml_09_clust.pdf · Clustering 12/12/2013 Machine Learning : Clustering, Self-Organizing Maps 2 The task: partition

Self-Organizing Maps

12/12/2013 Machine Learning : Clustering, Self-Organizing Maps 11

SOM-s (usually) consist of RBF-neurons , each one represents (covers) a “part” of the input space (specified by the centers ).

The network topology is given by means of a distance .Example – neurons are nodes of a weighted graph, distances are shortest paths. For the “flatland” example the graph is a 2D-grid with unit weight for all edges.

Page 12: Machine Learning : Clustering, Self-Organizing Mapsds24/lehre/ml_ws_2013/ml_09_clust.pdf · Clustering 12/12/2013 Machine Learning : Clustering, Self-Organizing Maps 2 The task: partition

Self-Organizing Maps, sequential algorithm

12/12/2013 Machine Learning : Clustering, Self-Organizing Maps 12

1. Chose randomly a feature vector from the training data (white)2. Compute the “winner”-neuron (dark-yellow)

3. Compute the neighborhood of in the network (yellow)

4. Update the weights of all neurons from

Page 13: Machine Learning : Clustering, Self-Organizing Mapsds24/lehre/ml_ws_2013/ml_09_clust.pdf · Clustering 12/12/2013 Machine Learning : Clustering, Self-Organizing Maps 2 The task: partition

Self-Organizing Maps, algorithms

12/12/2013 Machine Learning : Clustering, Self-Organizing Maps 13

is monotonously decreasing with respect to (time) and

Without 3) – the sequential K-Means.

Parallel variants:Go through all feature vectors, sum up the gradients, apply.

Example for :

The network fits into the data distribution (unfolds).

Page 14: Machine Learning : Clustering, Self-Organizing Mapsds24/lehre/ml_ws_2013/ml_09_clust.pdf · Clustering 12/12/2013 Machine Learning : Clustering, Self-Organizing Maps 2 The task: partition

K-Means ↔ Expectation Maximization

EM – compute posteriors for the Expectation step

K-Means – classify object

12/12/2013 Machine Learning : Clustering, Self-Organizing Maps 14

Page 15: Machine Learning : Clustering, Self-Organizing Mapsds24/lehre/ml_ws_2013/ml_09_clust.pdf · Clustering 12/12/2013 Machine Learning : Clustering, Self-Organizing Maps 2 The task: partition

Conclusion

12/12/2013 Machine Learning : Clustering, Self-Organizing Maps 15

Before:1. Probability theory – models, inference, learning2. → Discriminative learning → Classifiers

Neural networks:1. Feed-Forward Networks – complex classifiers2. Hopfield Networks – structured output3. Cohonen Networks – clustering (unsupervised), model fitting

Next topics – further classifiers:1. Support Vector Machines, Kernels2. Empirical Risk minimization3. Principal Component Analysis4. Combining classifiers – Decision Trees, AdaBoost