0
14kviews
Find clusters using k-means clustering algorithm if we have several objects (4 types of medicines) and each object have two attributes or features as shown in the table below.

The goal is to group these objects into k=2 group of medicine based on the two features (pH and weight index).

Object Attribute 1 (X) Weight Index Attribute 2 (Y) pH
Medicine A 1 1
Medicine B 2 1
Medicine C 4 3
Medicine D 5 4
1 Answer
2
1.7kviews
Object X Y
A 1 1
B 2 1
C 4 3
D 5 4

enter image description here

K = 2

1] Obtain adjacency matrix.

- A B C D
A 0 - - -
B 1 0 - -
C $\sqrt{13}$ $\sqrt{8}$ 0 -
D 5 $\sqrt{9}$ $\sqrt{2}$ 0

2] Let $c_1$ = {A} & $c_2$ = {B}

$\therefore$ centroid of $c_1$ = {A} = { (1,1) }

" $c_2$ = {B} = { (2,1)}

enter image description here

enter image description here

3] $c_1$ = {A}

$c_2$ = { B, C, D}

$\therefore$ centroid of $c_1$ = {(1,1)}

" $c_2$ {( $\frac{2+4+5}{3}, \frac{1+3+4}{3} )$}

= {(3.67, 2.67)}

enter image description here

enter image description here

3] $c_1$ = {A , B}

$c_2$ = {C , D}

$\therefore$ centroid of $c_1$ = { (1.5, 1)}

" $c_2$ = {(4.5, 3.5)}

enter image description here

enter image description here

$\therefore$ $c_1$ = {A, B}

$c_2$ = { C, D}

$\because$ there is no change, these are the final clusters.

Please log in to add an answer.