Friday, 24 February 2012

K-mean Clustering Algorithm

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
M2
K1
K2
2
4
{2,3}
{4,10,11,12,20,25,30}

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)
M1
M2
K1
K2
2
4
{2,3}
{4,10,11,12,20,25,30}
2.5
16
{2,3,4}
{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
M2
K1
K2
2
4
{2,3}
{4,10,11,12,20,25,30}
2.5
16
{2,3,4}
{10,11,12,20,25,30}
3
18
{2,3,4,10}
{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
M2
K1
K2
2
4
{2,3}
{4,10,11,12,20,25,30}
2.5
16
{2,3,4}
{10,11,12,20,25,30}
3
18
{2,3,4,10}
{11,12,20,25,30}
4.75
19.6
{2,3,4,10,11,12}
{20,25,30}


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) 
M1
M2
K1
K2
2
4
{2,3}
{4,10,11,12,20,25,30}
2.5
16
{2,3,4}
{10,11,12,20,25,30}
3
18
{2,3,4,10}
{11,12,20,25,30}
4.75
19.6
{2,3,4,10,11,12}
{20,25,30}
7
25
{2,3,4,10,11,12}
{20,25,30}

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}
                                                                                                                               



No comments:

Post a Comment

Computer Science

Syllabus,Book's Link,Practical's Solution ,Question Paper for BSc Computer Science and MSc Computer Science Of Mumbai University.