Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

Q. Use the k-mean clustering to solve the problem ?

Itemsets ={2,4,10,2,3,20,30,11,25} and Suppose


that k=2. With m1=2 and m2=4.
Solution:
Let
Cluster : k1=1 and k2=2

M1
2

M2
4

K1
{2,3}

Recalculate mean m1,m2 with items in k1 ={2,3} and k2= {4,10,11,12,20,25,30}


Therfore m1 =(2+3)/2 = 2.5
m2 =(4,10,11,12,20,25,30)/7 = 16
Now we have DistanceMean1 (2.5) ,DistanceMean2 (16)

K2
{4,10,11,12,20,25,30}

M1
2
2.5

M2
4
16

K1
{2,3}
{2,3,4}

K2
{4,10,11,12,20,25,30}
{10,11,12,20,25,30}

Recalculate mean m1,m2 with items in k1 ={2,3,4} and k2= {10,11,12,20,25,30}


Therfore m1 =(2+3+4)/3 = 3
m2 =(10+11+12+20+25+30)/6 = 18
Now we have DistanceMean1 (3) ,DistanceMean2 (18)

M1
2
2.5
3

M2
4
16
18

K1
{2,3}
{2,3,4}
{2,3,4,10}

K2
{4,10,11,12,20,25,30}
{10,11,12,20,25,30}
{11,12,20,25,30}

Recalculate mean m1,m2 with items in k1 ={2,3,4,10} and k2= {11,12,20,25,30}


Therfore m1 =(2+3+4+10)/4 = 4.75
m2 =(11+12+20+25+30)/5 = 19.6
Now we have DistanceMean1 (4.75) ,DistanceMean2 (19.6)

M1
2
2.5
3
4.75

M2
4
16
18
19.6

K1
{2,3}
{2,3,4}
{2,3,4,10}
{2,3,4,10,11,12}

Recalculate mean m1,m2 with items in k1 ={2,3,4,10,11,12} and k2= {20,25,30}


Therfore m1 =(2+3+4+10+11+12)/6 = 7
m2 =(11+12+20+25+30)/3 = 25
Now we have DistanceMean1 (7) ,DistanceMean2 (25)

K2
{4,10,11,12,20,25,30}
{10,11,12,20,25,30}
{11,12,20,25,30}
{20,25,30}

M1
2
2.5
3
4.75
7

M2
4
16
18
19.6
25

K1
{2,3}
{2,3,4}
{2,3,4,10}
{2,3,4,10,11,12}
{2,3,4,10,11,12}

Recalculate mean m1,m2 with items in k1 ={2,3,4,10,11,12} and k2= {20,25,30}


Therfore m1 =(2+3+4+10+11+12)/6 = 7
m2 =(11+12+20+25+30)/3 = 25
Now we have DistanceMean1 (7) ,DistanceMean2 (25)
Since we have same mean as previous iteration we stop here.
Thus k1 = {2,3,4,10,11,12} and k2 = {20,25,30}

K2
{4,10,11,12,20,25,30}
{10,11,12,20,25,30}
{11,12,20,25,30}
{20,25,30}
{20,25,30}

You might also like