Pengertian
• Pengelompokan object data sehingga object dalam suatu
kelompok sama (atau berelasi ) satu dengan yang lain namun
berbeda dari (atau tak berelasi ) objek di kelompok lain
Jarak antar
Jarak dalam kelompok di
kelopok di maksimumkan
minimumkan
Pencilan
• Pencilan merupakan objek yang tidak masuk dalam setiap
kelompok
cluster
Pencilan
Kenapa perlu kelompok
• Clustering : diberikan kelompok objek data sehingga
– Sama satu dengan yang lain dalam cluster sama
– Berbeda terhadap objek di cluster lain
• Pertanyaan mendasar:
– Apa artinya “similar”
– Bagaimana mengukur kualitas penyelesaian
– Bagaimana memperoleh partisi yang baik
Fungsi Jarak
• Jarak d(x, y) antara dua objek x dan y adalah metric
• data matriks
x11 ... x
1
... x
1d
...
tuples/objek
... ... ... ...
x ... x ... x
i1 i id
... ... ... ... ...
x ... x ... x
n1 n nd
objek
• Matriks jarak 0
d(2,1) 0
objek
d(3,1) d ( 3,2) 0
: : :
d ( n,1) d ( n,2) ... ... 0
Distance functions for binary vectors
• Jaccard similarity between binary vectors X and Y
X Y
JSim ( X , Y )
X Y
• Jaccard distance between binary vectors X and Y
Jdist(X,Y) = 1- JSim(X,Y)
Q1 Q2 Q3 Q4 Q5 Q6
• Example: X 1 0 0 1 1 1
• JSim = 1/6 Y 0 1 1 0 1 0
• Jdist = 5/6
Distance functions for real-valued vectors
• Lp norms or Minkowski distance:
1/ p
p p p 1/ p
d
L p ( x, y) | x y | | x y | ... | x x |
(x y )
1 1 2 2 d d
i 1 i i
d
L ( x, y) | x1 y1 | | x y | ... | x y | x y
1 2 2 d d i i
i 1
Distance functions for real-valued
vectors
• If p = 2, L2 is the Euclidean distance:
d ( x, y) (| x y |2 | x y |2 ... | x y |2 )
1 1 2 2 d d
d ( x, y) w x y w x y ... w x y
1 1 1 2 2 2 d d d
i 1 xCi
is minimized
• Some special cases: k = 1, k = n
Algorithmic properties of the k-means
problem
• NP-hard if the dimensionality of the data is at least 2
(d>=2)
2.5
2
Original Points
1.5
y
1
0.5
3 3
2.5 2.5
2 2
1.5 1.5
y
y
1 1
0.5 0.5
0 0
is minimized
The k-center problem
• Given a set X of n points in a d-dimensional space
and an integer k
• Proof:
– Rj=d(j,π(j)) = d(j,{1,2,…,j-1})
≤d(j,{1,2,…,i-1}) //j > i
≤d(i,{1,2,…,i-1}) = Ri
The farthest-first traversal is a 2-
approximation algorithm
• Proof:
– For all i > k we have that
d(i, {1,2,…,k})≤ d(k+1,{1,2,…,k}) = Rk+1