machine learning for signal processing clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… ·...
TRANSCRIPT
![Page 1: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/1.jpg)
Machine Learning for Signal Processing Clustering
Bhiksha Raj
Class 12. 10 Oct 2013
10 Oct 2013 1
![Page 2: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/2.jpg)
Statistical Modelling and Latent Structure
• Much of statistical modelling attempts to identify latent structure in the data
– Structure that is not immediately apparent from the observed data
– But which, if known, helps us explain it better, and make predictions from or about it
• Clustering methods attempt to extract such structure from proximity
– First-level structure (as opposed to deep structure)
• We will see other forms of latent structure discovery later in the course
10 Oct 2013 2
![Page 3: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/3.jpg)
Clustering
10 Oct 2013 3
![Page 4: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/4.jpg)
How
10 Oct 2013 4
![Page 5: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/5.jpg)
Clustering
• What is clustering
– Clustering is the determination of naturally occurring grouping of data/instances (with low within-group variability and high between-group variability)
10 Oct 2013
![Page 6: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/6.jpg)
Clustering
• What is clustering
– Clustering is the determination of naturally occurring grouping of data/instances (with low within-group variability and high between-group variability)
10 Oct 2013
![Page 7: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/7.jpg)
Clustering
• What is clustering
– Clustering is the determination of naturally occurring grouping of data/instances (with low within-group variability and high between-group variability)
• How is it done
– Find groupings of data such that the groups optimize a “within-group-variability” objective function of some kind
10 Oct 2013
![Page 8: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/8.jpg)
Clustering
• What is clustering
– Clustering is the determination of naturally occurring grouping of data/instances (with low within-group variability and high between-group variability)
• How is it done
– Find groupings of data such that the groups optimize a “within-group-variability” objective function of some kind
– The objective function used affects the nature of the discovered clusters
• E.g. Euclidean distance vs.
• Distance from center
10 Oct 2013 8
![Page 9: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/9.jpg)
Clustering
• What is clustering
– Clustering is the determination of naturally occurring grouping of data/instances (with low within-group variability and high between-group variability)
• How is it done
– Find groupings of data such that the groups optimize a “within-group-variability” objective function of some kind
– The objective function used affects the nature of the discovered clusters
• E.g. Euclidean distance vs.
• Distance from center
10 Oct 2013 9
![Page 10: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/10.jpg)
Why Clustering
• Automatic grouping into “Classes” – Different clusters may show different behavior
• Quantization – All data within a cluster are represented by a
single point
• Preprocessing step for other algorithms – Indexing, categorization, etc.
10 Oct 2013 10
![Page 11: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/11.jpg)
Finding natural structure in data
• Find natural groupings in data for further analysis
• Discover latent structure in data
10 Oct 2013 11
![Page 12: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/12.jpg)
Some Applications of Clustering
• Image segmentation
10 Oct 2013 12
![Page 13: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/13.jpg)
Representation: Quantization
• Quantize every vector to one of K (vector) values
• What are the optimal K vectors? How do we find them? How do we perform the quantization?
• LBG algorithm 13
TRAINING QUANTIZATION
x
x
![Page 14: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/14.jpg)
Representation: BOW
• How to retrieve all music videos by this guy? • Build a classifier
– But how do you represent the video? 10 Oct 2013 14
![Page 15: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/15.jpg)
Representation: BOW
• Bag of words representations of video/audio/data
10 Oct 2013 15
Representation: Each number is the
#frames assigned to the codeword
30
17
4 12
16
Training: Each point is a video frame
![Page 16: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/16.jpg)
Obtaining “Meaningful” Clusters
• Two key aspects:
– 1. The feature representation used to characterize your data
– 2. The “clustering criteria” employed
10 Oct 2013 16
![Page 17: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/17.jpg)
Clustering Criterion
• The “Clustering criterion” actually has two aspects
• Cluster compactness criterion – Measure that shows how “good” clusters are
• The objective function
• Distance of a point from a cluster – To determine the cluster a data vector belongs to
10 Oct 2013 17
![Page 18: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/18.jpg)
“Compactness” criteria for clustering
• Distance based measures – Total distance between each
element in the cluster and every other element in the cluster
10 Oct 2013 18
![Page 19: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/19.jpg)
• Distance based measures – Total distance between each
element in the cluster and every other element in the cluster
10 Oct 2013 19
“Compactness” criteria for clustering
![Page 20: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/20.jpg)
“Compactness” criteria for clustering
• Distance based measures – Total distance between each
element in the cluster and every other element in the cluster
– Distance between the two farthest points in the cluster
10 Oct 2013 20
![Page 21: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/21.jpg)
“Compactness” criteria for clustering
• Distance based measures – Total distance between each
element in the cluster and every other element in the cluster
– Distance between the two farthest points in the cluster
– Total distance of every element in the cluster from the centroid of the cluster
10 Oct 2013 21
![Page 22: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/22.jpg)
“Compactness” criteria for clustering
• Distance based measures – Total distance between each
element in the cluster and every other element in the cluster
– Distance between the two farthest points in the cluster
– Total distance of every element in the cluster from the centroid of the cluster
10 Oct 2013 22
![Page 23: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/23.jpg)
“Compactness” criteria for clustering
• Distance based measures – Total distance between each
element in the cluster and every other element in the cluster
– Distance between the two farthest points in the cluster
– Total distance of every element in the cluster from the centroid of the cluster
10 Oct 2013 23
![Page 24: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/24.jpg)
“Compactness” criteria for clustering
• Distance based measures – Total distance between each
element in the cluster and every other element in the cluster
– Distance between the two farthest points in the cluster
– Total distance of every element in the cluster from the centroid of the cluster
– Distance measures are often weighted Minkowski metrics
nn
MMM
nnbawbawbawdist ...222111
10 Oct 2013 24
![Page 25: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/25.jpg)
Clustering: Distance from cluster
• How far is a data point from a cluster?
– Euclidean or Minkowski distance from the centroid of the cluster
– Distance from the closest point in the cluster
– Distance from the farthest point in the cluster
– Probability of data measured on cluster distribution
10 Oct 2013 25
![Page 26: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/26.jpg)
Clustering: Distance from cluster
• How far is a data point from a cluster?
– Euclidean or Minkowski distance from the centroid of the cluster
– Distance from the closest point in the cluster
– Distance from the farthest point in the cluster
– Probability of data measured on cluster distribution
10 Oct 2013 26
![Page 27: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/27.jpg)
Clustering: Distance from cluster
• How far is a data point from a cluster?
– Euclidean or Minkowski distance from the centroid of the cluster
– Distance from the closest point in the cluster
– Distance from the farthest point in the cluster
– Probability of data measured on cluster distribution
10 Oct 2013 27
![Page 28: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/28.jpg)
Clustering: Distance from cluster
• How far is a data point from a cluster?
– Euclidean or Minkowski distance from the centroid of the cluster
– Distance from the closest point in the cluster
– Distance from the farthest point in the cluster
– Probability of data measured on cluster distribution
10 Oct 2013 28
![Page 29: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/29.jpg)
Clustering: Distance from cluster
• How far is a data point from a cluster? – Euclidean or Minkowski distance
from the centroid of the cluster
– Distance from the closest point in the cluster
– Distance from the farthest point in the cluster
– Probability of data measured on cluster distribution
– Fit of data to cluster-based regression
10 Oct 2013 29
![Page 30: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/30.jpg)
Optimal clustering: Exhaustive enumeration
• All possible combinations of data must be evaluated
– If there are M data points, and we desire N clusters, the number of ways of separating M instances into N clusters is
– Exhaustive enumeration based clustering requires that the objective function (the “Goodness measure”) be evaluated for every one of these, and the best one chosen
• This is the only correct way of optimal clustering
– Unfortunately, it is also computationally unrealistic
N
i
Mi iNi
N
M 0
)()1(!
1
10 Oct 2013 30
![Page 31: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/31.jpg)
Not-quite non sequitur: Quantization
• Linear quantization (uniform quantization):
– Each digital value represents an equally wide range of analog values
– Regardless of distribution of data
– Digital-to-analog conversion represented by a “uniform” table
10 Oct 2013 31
Signal Value Bits Mapped to
S >= 3.75v 11 3 * const
3.75v > S >= 2.5v 10 2 * const
2.5v > S >= 1.25v 01 1 * const
1.25v > S >= 0v 0 0
Analog value (arrows are quantization levels) Prob
abilit
y of
ana
log
valu
e
![Page 32: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/32.jpg)
Not-quite non sequitur: Quantization
• Non-Linear quantization:
– Each digital value represents a different range of analog values
• Finer resolution in high-density areas
• Mu-law / A-law assumes a Gaussian-like distribution of data
– Digital-to-analog conversion represented by a “non-uniform” table
10 Oct 2013 32
Analog value (arrows are quantization levels) Prob
abilit
y of
ana
log
valu
e
Signal Value Bits Mapped to
S >= 4v 11 4.5
4v > S >= 2.5v 10 3.25
2.5v > S >= 1v 01 1.25
1.0v > S >= 0v 0 0.5
![Page 33: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/33.jpg)
Non-uniform quantization
• If data distribution is not Gaussian-ish? – Mu-law / A-law are not optimal
– How to compute the optimal ranges for quantization? • Or the optimal table
10 Oct 2013 33
Analog value Prob
abilit
y of
ana
log
valu
e
![Page 34: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/34.jpg)
The Lloyd Quantizer
• Lloyd quantizer: An iterative algorithm for computing optimal quantization tables for non-uniformly distributed data
• Learned from “training” data
10 Oct 2013 34
Analog value (arrows show quantization levels)
Prob
abilit
y of
ana
log
valu
e
![Page 35: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/35.jpg)
Lloyd Quantizer
• Randomly initialize quantization points
– Right column entries of quantization table
• Assign all training points to the nearest quantization point
• Reestimate quantization points
• Iterate until convergence
10 Oct 2013 35
![Page 36: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/36.jpg)
Lloyd Quantizer
• Randomly initialize quantization points – Right column entries of
quantization table
• Assign all training points to the nearest quantization point – Draw boundaries
• Reestimate quantization points
• Iterate until convergence 10 Oct 2013
36
![Page 37: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/37.jpg)
Lloyd Quantizer
• Randomly initialize quantization points – Right column entries of
quantization table
• Assign all training points to the nearest quantization point – Draw boundaries
• Reestimate quantization points
• Iterate until convergence 10 Oct 2013
37
![Page 38: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/38.jpg)
Lloyd Quantizer
• Randomly initialize quantization points – Right column entries of
quantization table
• Assign all training points to the nearest quantization point – Draw boundaries
• Reestimate quantization points
• Iterate until convergence 10 Oct 2013
38
![Page 39: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/39.jpg)
Generalized Lloyd Algorithm: K–means clustering
• K means is an iterative algorithm for clustering vector
data
– McQueen, J. 1967. “Some methods for classification and
analysis of multivariate observations.” Proceedings of the Fifth
Berkeley Symposium on Mathematical Statistics and Probability,
281-297
• General procedure:
– Initially group data into the required number of clusters
somehow (initialization)
– Assign each data point to the closest cluster
– Once all data points are assigned to clusters, redefine clusters
– Iterate
10 Oct 2013 39
![Page 40: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/40.jpg)
K–means
• Problem: Given a set of data vectors, find natural clusters
• Clustering criterion is scatter: distance from the centroid
– Every cluster has a centroid
– The centroid represents the cluster
• Definition: The centroid is the weighted mean of the cluster
– Weight = 1 for basic scheme
10 Oct 2013 40
clusteri
ii
clusteri
i
cluster xww
m1
![Page 41: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/41.jpg)
K–means
10 Oct 2013 41
1. Initialize a set of centroids randomly
2. For each data point x, find the distance from the centroid for each cluster
•
3. Put data point in the cluster of the closest centroid
• Cluster for which dcluster is minimum
4. When all data points clustered, recompute cluster centroid
5. If not converged, go back to 2
),( clustercluster mxd distance
clusteri
i
cluster
cluster xN
m1
![Page 42: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/42.jpg)
K–means
10 Oct 2013 42
1. Initialize a set of centroids randomly
2. For each data point x, find the distance from the centroid for each cluster
•
3. Put data point in the cluster of the closest centroid
• Cluster for which dcluster is minimum
4. When all data points clustered, recompute cluster centroid
5. If not converged, go back to 2
),( clustercluster mxd distance
clusteri
i
cluster
cluster xN
m1
![Page 43: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/43.jpg)
K–means
10 Oct 2013 43
1. Initialize a set of centroids randomly
2. For each data point x, find the distance from the centroid for each cluster
•
3. Put data point in the cluster of the closest centroid
• Cluster for which dcluster is minimum
4. When all data points clustered, recompute cluster centroid
5. If not converged, go back to 2
),( clustercluster mxd distance
clusteri
i
cluster
cluster xN
m1
![Page 44: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/44.jpg)
K–means
10 Oct 2013 44
1. Initialize a set of centroids randomly
2. For each data point x, find the distance from the centroid for each cluster
•
3. Put data point in the cluster of the closest centroid
• Cluster for which dcluster is minimum
4. When all data points clustered, recompute cluster centroid
5. If not converged, go back to 2
),( clustercluster mxd distance
clusteri
i
cluster
cluster xN
m1
![Page 45: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/45.jpg)
K–means
10 Oct 2013 45
1. Initialize a set of centroids randomly
2. For each data point x, find the distance from the centroid for each cluster
•
3. Put data point in the cluster of the closest centroid
• Cluster for which dcluster is minimum
4. When all data points clustered, recompute cluster centroid
5. If not converged, go back to 2
),( clustercluster mxd distance
clusteri
i
cluster
cluster xN
m1
![Page 46: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/46.jpg)
K–means
10 Oct 2013 46
1. Initialize a set of centroids randomly
2. For each data point x, find the distance from the centroid for each cluster
•
3. Put data point in the cluster of the closest centroid
• Cluster for which dcluster is minimum
4. When all data points clustered, recompute cluster centroid
5. If not converged, go back to 2
),( clustercluster mxd distance
clusteri
i
cluster
cluster xN
m1
![Page 47: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/47.jpg)
K–means
10 Oct 2013 47
1. Initialize a set of centroids randomly
2. For each data point x, find the distance from the centroid for each cluster
•
3. Put data point in the cluster of the closest centroid
• Cluster for which dcluster is minimum
4. When all data points clustered, recompute cluster centroid
5. If not converged, go back to 2
),( clustercluster mxd distance
clusteri
i
cluster
cluster xN
m1
![Page 48: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/48.jpg)
K–means
10 Oct 2013 48
1. Initialize a set of centroids randomly
2. For each data point x, find the distance from the centroid for each cluster
•
3. Put data point in the cluster of the closest centroid
• Cluster for which dcluster is minimum
4. When all data points clustered, recompute cluster centroid
5. If not converged, go back to 2
),( clustercluster mxd distance
clusteri
i
cluster
cluster xN
m1
![Page 49: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/49.jpg)
K–means
10 Oct 2013 49
1. Initialize a set of centroids randomly
2. For each data point x, find the distance from the centroid for each cluster
•
3. Put data point in the cluster of the closest centroid
• Cluster for which dcluster is minimum
4. When all data points clustered, recompute cluster centroid
5. If not converged, go back to 2
),( clustercluster mxd distance
clusteri
i
cluster
cluster xN
m1
![Page 50: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/50.jpg)
K–means
10 Oct 2013 50
1. Initialize a set of centroids randomly
2. For each data point x, find the distance from the centroid for each cluster
•
3. Put data point in the cluster of the closest centroid
• Cluster for which dcluster is minimum
4. When all data points are clustered, recompute centroids
5. If not converged, go back to 2
),( clustercluster mxd distance
clusteri
ii
clusteri
i
cluster xww
m1
![Page 51: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/51.jpg)
K–means
51
1. Initialize a set of centroids
randomly
2. For each data point x, find the
distance from the centroid for
each cluster
•
3. Put data point in the cluster of the
closest centroid
• Cluster for which dcluster is
minimum
4. When all data points are
clustered, recompute centroids
5. If not converged, go back to 2
),( clustercluster mxd distance
clusteri
ii
clusteri
i
cluster xww
m1
![Page 52: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/52.jpg)
K-Means comments
• The distance metric determines the clusters
– In the original formulation, the distance is L2 distance
• Euclidean norm, wi = 1
– If we replace every x by mcluster(x), we get Vector Quantization
• K-means is an instance of generalized EM
• Not guaranteed to converge for all distance metrics
10 Oct 2013 52
clusteri
i
cluster
cluster xN
m1
2||||),( clusterclustercluster mxmx distance
![Page 53: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/53.jpg)
Initialization
• Random initialization
• Top-down clustering
– Initially partition the data into two (or a small number of) clusters using K means
– Partition each of the resulting clusters into two (or a small number of) clusters, also using K means
– Terminate when the desired number of clusters is obtained
10 Oct 2013 53
![Page 54: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/54.jpg)
K-Means for Top–Down clustering
10 Oct 2013 54
1. Start with one cluster
2. Split each cluster into two: Perturb centroid of cluster slightly (by < 5%) to
generate two centroids
3. Initialize K means with new set of centroids
4. Iterate Kmeans until convergence
5. If the desired number of clusters is not obtained, return to 2
![Page 55: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/55.jpg)
K-Means for Top–Down clustering
10 Oct 2013 55
1. Start with one cluster
2. Split each cluster into two: Perturb centroid of cluster slightly (by < 5%) to
generate two centroids
3. Initialize K means with new set of centroids
4. Iterate Kmeans until convergence
5. If the desired number of clusters is not obtained, return to 2
![Page 56: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/56.jpg)
K-Means for Top–Down clustering
10 Oct 2013 56
1. Start with one cluster
2. Split each cluster into two: Perturb centroid of cluster slightly (by < 5%) to
generate two centroids
3. Initialize K means with new set of centroids
4. Iterate Kmeans until convergence
5. If the desired number of clusters is not obtained, return to 2
![Page 57: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/57.jpg)
K-Means for Top–Down clustering
10 Oct 2013 57
1. Start with one cluster
2. Split each cluster into two: Perturb centroid of cluster slightly (by < 5%) to
generate two centroids
3. Initialize K means with new set of centroids
4. Iterate Kmeans until convergence
5. If the desired number of clusters is not obtained, return to 2
![Page 58: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/58.jpg)
K-Means for Top–Down clustering
10 Oct 2013 58
1. Start with one cluster
2. Split each cluster into two: Perturb centroid of cluster slightly (by < 5%) to
generate two centroids
3. Initialize K means with new set of centroids
4. Iterate Kmeans until convergence
5. If the desired number of clusters is not obtained, return to 2
![Page 59: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/59.jpg)
K-Means for Top–Down clustering
10 Oct 2013 59
1. Start with one cluster
2. Split each cluster into two: Perturb centroid of cluster slightly (by < 5%) to
generate two centroids
3. Initialize K means with new set of centroids
4. Iterate Kmeans until convergence
5. If the desired number of clusters is not obtained, return to 2
![Page 60: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/60.jpg)
K-Means for Top–Down clustering 1. Start with one cluster
2. Split each cluster into two: – Perturb centroid of cluster slightly (by < 5%) to
generate two centroids
3. Initialize K means with new set of centroids
4. Iterate Kmeans until convergence
5. If the desired number of clusters is not obtained, return to 2
10 Oct 2013 60
![Page 61: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/61.jpg)
K-Means for Top–Down clustering 1. Start with one cluster
2. Split each cluster into two: – Perturb centroid of cluster slightly (by < 5%) to
generate two centroids
3. Initialize K means with new set of centroids
4. Iterate Kmeans until convergence
5. If the desired number of clusters is not obtained, return to 2
10 Oct 2013 61
![Page 62: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/62.jpg)
Non-Euclidean clusters
• Basic K-means results in good clusters in Euclidean spaces
– Alternately stated, will only find clusters that are “good” in terms of Euclidean distances
• Will not find other types of clusters
10 Oct 2013 62
![Page 63: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/63.jpg)
• For other forms of clusters we must modify the distance measure
– E.g. distance from a circle
• May be viewed as a distance in a higher dimensional space
– I.e Kernel distances
– Kernel K-means
• Other related clustering mechansims:
– Spectral clustering – Non-linear weighting of adjacency
– Normalized cuts.. 10 Oct 2013 63
f([x,y]) -> [x,y,z]
x = x
y = y
z = a(x2 + y2)
Non-Euclidean clusters
![Page 64: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/64.jpg)
• Transform the data into a synthetic higher-dimensional space where the desired patterns become natural clusters
– E.g. the quadratic transform above
• Problem: What is the function/space?
• Problem: Distances in higher dimensional-space are more expensive to compute
– Yet only carry the same information in the lower-dimensional space 10 Oct 2013 64
f([x,y]) -> [x,y,z]
x = x
y = y
z = a(x2 + y2)
The Kernel Trick
![Page 65: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/65.jpg)
Distance in higher-dimensional space
• Transform data x through a possibly unknown function F(x) into a higher (potentially infinite) dimensional space
– z = F(x)
• The distance between two points is computed in the higher-dimensional space
– d(x1, x2) = ||z1- z2||2 = ||F(x1) – F(x2)||2
• d(x1, x2) can be computed without computing z
– Since it is a direct function of x1 and x2
10 Oct 2013 65
![Page 66: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/66.jpg)
Distance in higher-dimensional space
• Distance in lower-dimensional space: A combination of
dot products
– ||z1- z2||2 = (z1- z2)T(z1- z2) = z1.z1 + z2.z2 -2 z1.z2
• Distance in higher-dimensional space
– d(x1, x2) =||F(x1) – F(x2)||2
= F(x1). F(x1) + F(x2). F(x2) -2 F(x1). F(x2)
• d(x1, x2) can be computed without knowing F(x) if:
– F(x1). F(x2) can be computed for any x1 and x2 without
knowing F(.)
10 Oct 2013 66
![Page 67: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/67.jpg)
The Kernel function
• A kernel function K(x1,x2) is a function such that:
– K(x1,x2) = F(x1). F(x2)
• Once such a kernel function is found, the distance in higher-dimensional space can be found in terms of the kernels
– d(x1, x2) =||F(x1) – F(x2)||2 = F(x1). F(x1) + F(x2). F(x2) -2 F(x1). F(x2) = K(x1,x1) + K(x2,x2) - 2K(x1,x2)
• But what is K(x1,x2)?
10 Oct 2013 67
![Page 68: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/68.jpg)
A property of the dot product
• For any vector v, vTv = ||v||2 >= 0
– This is just the length of v and is therefore non-negative
• For any vector u = Si ai vi, ||u||2 >=0
=> (Si ai vi)T(Si ai vi) >= 0
=> Si Sj ai aj vi .vj >= 0
• This holds for ANY real {a1, a2, …}
10 Oct 2013 68
![Page 69: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/69.jpg)
The Mercer Condition
• If z = F(x) is a high-dimensional vector derived from x then for all real {a1, a2, …} and any set {z1, z2, … } = {F(x1), F(x2),…}
– Si Sj ai aj zi .zj >= 0
– Si Sj ai aj F(xi).F(xj) >= 0
• If K(x1,x2) = F(x1). F(x2)
> Si Sj ai aj K(xi,xj) >= 0
• Any function K() that satisfies the above condition is a valid kernel function
10 Oct 2013 69
![Page 70: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/70.jpg)
The Mercer Condition
• K(x1,x2) = F(x1). F(x2)
> Si Sj ai aj K(xi,xj) >= 0
• A corollary: If any kernel K(.) satisfies the Mercer condition d(x1, x2) = K(x1,x1) + K(x2,x2) - 2K(x1,x2) satisfies the following requirements for a “distance”
– d(x,x) = 0
– d(x,y) >= 0
– d(x,w) + d(w,y) >= d(x,y)
10 Oct 2013 70
![Page 71: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/71.jpg)
Typical Kernel Functions
• Linear: K(x,y) = xTy + c
• Polynomial K(x,y) = (axTy + c)n
• Gaussian: K(x,y) = exp(-||x-y||2/s2)
• Exponential: K(x,y) = exp(-||x-y||/l)
• Several others – Choosing the right Kernel with the right
parameters for your problem is an artform
10 Oct 2013 71
![Page 72: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/72.jpg)
• Perform the K-mean in the Kernel space
– The space of z = F(x)
• The algorithm..
10 Oct 2013 72
K(x,y)= (xT y + c)2
Kernel K-means
![Page 73: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/73.jpg)
The mean of a cluster
• The average value of the points in the cluster computed in the high-dimensional space
• Alternately the weighted average
10 Oct 2013 73
Fclusteri
i
cluster
cluster xN
m )(1
FFclusteri
ii
clusteri
ii
clusteri
i
cluster xwCxww
m )()(1
![Page 74: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/74.jpg)
The mean of a cluster
• The average value of the points in the cluster computed in the high-dimensional space
• Alternately the weighted average
10 Oct 2013 74
Fclusteri
i
cluster
cluster xN
m )(1
FFclusteri
ii
clusteri
ii
clusteri
i
cluster xwCxww
m )()(1
RECALL: We may never actually be able to compute this mean because
F(x) is not known
![Page 75: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/75.jpg)
K–means
• Initialize the clusters with a random set of K points
– Cluster has 1 point
• For each data point x, find the closest cluster
10 Oct 2013 75
Fclusteri
ii
clusteri
i
cluster )x(ww
1m
2
clusterclustercluster ||m)x(||min)cluster,x(dmin)x(cluster F
FF
FFF
clusteri
ii
T
clusteri
ii
2
cluster )x(wC)x()x(wC)x(||m)x(||)cluster,x(d
FFFFFF
clusteri clusteri clusterj
j
T
iji
2
i
T
i
T )x()x(wwC)x()x(wC2)x()x(
clusteri clusteri clusterj
jiji
2
ii )x,x(KwwC)x,x(KwC2)x,x(K
Computed entirely using only the kernel function!
![Page 76: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/76.jpg)
K–means
10 Oct 2013 76
1. Initialize a set of clusters randomly
2. For each data point x, find the distance from the centroid for each cluster
•
3. Put data point in the cluster of the closest centroid
• Cluster for which dcluster is minimum
4. When all data points clustered, recompute cluster centroid
5. If not converged, go back to 2
),( clustercluster mxd distance
clusteri
i
cluster
cluster xN
m1
![Page 77: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/77.jpg)
K–means
10 Oct 2013 77
1. Initialize a set of clusters randomly
2. For each data point x, find the distance from the centroid for each cluster
•
3. Put data point in the cluster of the closest centroid
• Cluster for which dcluster is minimum
4. When all data points clustered, recompute cluster centroid
5. If not converged, go back to 2
),( clustercluster mxd distance
clusteri
i
cluster
cluster xN
m1
The centroids are virtual: we don’t actually compute them explicitly!
clusteri
ii
clusteri
i
cluster xww
m1
![Page 78: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/78.jpg)
K–means
10 Oct 2013 78
1. Initialize a set of clusters randomly
2. For each data point x, find the distance from the centroid for each cluster
•
3. Put data point in the cluster of the closest centroid
• Cluster for which dcluster is minimum
4. When all data points clustered, recompute cluster centroid
5. If not converged, go back to 2
),( clustercluster mxd distance
clusteri
i
cluster
cluster xN
m1
![Page 79: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/79.jpg)
K–means
10 Oct 2013 79
1. Initialize a set of clusters randomly
2. For each data point x, find the distance from the centroid for each cluster
•
3. Put data point in the cluster of the closest centroid
• Cluster for which dcluster is minimum
4. When all data points clustered, recompute cluster centroid
5. If not converged, go back to 2
),( clustercluster mxd distance
clusteri
i
cluster
cluster xN
m1
![Page 80: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/80.jpg)
K–means
10 Oct 2013 80
1. Initialize a set of clusters randomly
2. For each data point x, find the distance from the centroid for each cluster
•
3. Put data point in the cluster of the closest centroid
• Cluster for which dcluster is minimum
4. When all data points clustered, recompute cluster centroid
5. If not converged, go back to 2
),( clustercluster mxd distance
clusteri
i
cluster
cluster xN
m1
![Page 81: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/81.jpg)
K–means
10 Oct 2013 81
1. Initialize a set of clusters randomly
2. For each data point x, find the distance from the centroid for each cluster
•
3. Put data point in the cluster of the closest centroid
• Cluster for which dcluster is minimum
4. When all data points clustered, recompute cluster centroid
5. If not converged, go back to 2
),( clustercluster mxd distance
clusteri
i
cluster
cluster xN
m1
![Page 82: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/82.jpg)
K–means
10 Oct 2013 82
1. Initialize a set of clusters randomly
2. For each data point x, find the distance from the centroid for each cluster
•
3. Put data point in the cluster of the closest centroid
• Cluster for which dcluster is minimum
4. When all data points clustered, recompute cluster centroid
5. If not converged, go back to 2
),( clustercluster mxd distance
clusteri
i
cluster
cluster xN
m1
![Page 83: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/83.jpg)
K–means
10 Oct 2013 83
1. Initialize a set of clusters randomly
2. For each data point x, find the distance from the centroid for each cluster
•
3. Put data point in the cluster of the closest centroid
• Cluster for which dcluster is minimum
4. When all data points clustered, recompute cluster centroid
5. If not converged, go back to 2
),( clustercluster mxd distance
clusteri
i
cluster
cluster xN
m1
![Page 84: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/84.jpg)
K–means
10 Oct 2013 84
1. Initialize a set of clusters randomly
2. For each data point x, find the distance from the centroid for each cluster
•
3. Put data point in the cluster of the closest centroid
• Cluster for which dcluster is minimum
4. When all data points clustered, recompute cluster centroid
5. If not converged, go back to 2
),( clustercluster mxd distance
clusteri
i
cluster
cluster xN
m1
![Page 85: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/85.jpg)
K–means
10 Oct 2013 85
1. Initialize a set of clusters randomly
2. For each data point x, find the distance from the centroid for each cluster
•
3. Put data point in the cluster of the closest centroid
• Cluster for which dcluster is minimum
4. When all data points clustered, recompute cluster centroid
5. If not converged, go back to 2
),( clustercluster mxd distance
clusteri
i
cluster
cluster xN
m1
![Page 86: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/86.jpg)
K–means
10 Oct 2013 86
1. Initialize a set of clusters randomly
2. For each data point x, find the distance from the centroid for each cluster
•
3. Put data point in the cluster of the closest centroid
• Cluster for which dcluster is minimum
4. When all data points are clustered, recompute centroids
5. If not converged, go back to 2
),( clustercluster mxd distance
clusteri
ii
clusteri
i
cluster xww
m1
• We do not explicitly compute the
means
• May be impossible – we do not
know the high-dimensional
space
• We only know how to compute
inner products in it
![Page 87: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/87.jpg)
Kernel K–means
87
1. Initialize a set of clusters randomly
2. For each data point x, find the distance from the centroid for each cluster
•
3. Put data point in the cluster of the closest centroid
• Cluster for which dcluster is minimum
4. When all data points are clustered, recompute centroids
5. If not converged, go back to 2
),( clustercluster mxd distance
clusteri
ii
clusteri
i
cluster xww
m1
• We do not explicitly compute the
means
• May be impossible – we do not
know the high-dimensional
space
• We only know how to compute
inner products in it
![Page 88: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/88.jpg)
How many clusters?
• Assumptions:
– Dimensionality of kernel space > no. of clusters
– Clusters represent separate directions in Kernel spaces
• Kernel correlation matrix K
– Kij = K(xi,xj)
• Find Eigen values L and Eigen vectors e of kernel
matrix
– No. of clusters = no. of dominant li (1Tei) terms
10 Oct 2013 88
![Page 89: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/89.jpg)
Spectral Methods
• “Spectral” methods attempt to find “principal” subspaces of the high-dimensional kernel space
• Clustering is performed in the principal subspaces
– Normalized cuts
– Spectral clustering
• Involves finding Eigenvectors and Eigen values of Kernel matrix
• Fortunately, provably analogous to Kernel K-means
10 Oct 2013 89
![Page 90: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/90.jpg)
Other clustering methods
• Regression based clustering
• Find a regression representing each cluster
• Associate each point to the cluster with the best regression
– Related to kernel methods
10 Oct 2013 90
![Page 91: Machine Learning for Signal Processing Clusteringbhiksha/courses/mlsp.fall2013/lectures/sli… · • Mu-law / A-law assumes a Gaussian-like distribution of data – Digital-to-analog](https://reader034.vdocuments.net/reader034/viewer/2022042802/5f40e278358ff3241063a265/html5/thumbnails/91.jpg)
Clustering..
• Many many other variants
• Many applications..
• Important: Appropriate choice of feature
– Appropriate choice of feature may eliminate need for kernel trick..
– Google is your friend.
10 Oct 2013 91