1
K-Means Clustering
Given N observations {x
1
, …, x
N
} where x
∈
R
d
How do we partition the N observations into k
sets S = {S_1, …, S_k} where k < N?
In general:
Difficult problem whether working with identifying 2
d
© R. Siegwart, I. Nourbakhsh
MEM380: Fundamental Robotics I Fall 2009
1
clusters in R
OR identifying k clusters in 2-D
Often used in many applications
An Example
MEM380: Fundamental Robotics I Fall 2009
2
A Simple Algorithm
Given N observations
Let m
i
denote the centroid of the set S
i
for
i=1, …, k
Two steps:
1.
Assignment step
2.
Update step
MEM380: Fundamental Robotics I Fall 2009
3
Some Pseudocode
% Iterate k-means
means = initialGuesses;
while
true
% Compute cluster membership
membership = assign_clusters(means, data);
old_means = means;
% Update means based on new membership information
for
i = 1:k
means(i,:)
= mean(all x_j \in S_i);
end
% Decide if you are done
MEM380: Fundamental Robotics I Fall 2009
4

This ** preview** has intentionally

**sections.**

*blurred***to view the full version.**

*Sign up*
2
An Example
Matlab Demo
MEM380: Fundamental Robotics I Fall 2009
5
Our Initial Example
MEM380: Fundamental Robotics I Fall 2009
6
Applying k-means clustering
MEM380: Fundamental Robotics I Fall 2009
7
Localization
Where am I?