K-mean clustering Algorithm


                        K-mean Algorithm


Step - 1:  Take a mean value.

Step - 2: Find Nearest number of  mean & put in cluster .

Step - 3: Repeat one and two will get same mean .


Suppose  given that { 2, 3, 4, 10, 11, 12, 20, 25, 30} and also give k = 2

So the solution is -
{ 2, 3, 4, 10, 11, 12, 20, 25, 30}

Suppose  I assumed  m1 = 4  &  m2 = 12
          
  1. m1 = 4 ->
  2. K1 ={2,3,4} Apply - |x1- x|[formula]
2. m2 = 12 ->
 K2={10,11,12,20,25,30}    

This time m1 value is =3 &  m2 value is = 18     

because this time formula is - [ The sum of the above numbers plus division is as many numbers as there are]      

Again, The sum of the above numbers plus division is as many numbers as there are

 m1 = 3 -> 
K1={2,3,4,10}
m2 = 18 -> 
k2={11,12,20,25,30}       

Then we Again get, The sum of the above numbers plus division is as many numbers as there are
m1 = 5
k1={2,3,4,10,11,12}
m2= 20
k2 ={20,25,30}

Again The sum of the above numbers plus division is as many numbers as there are
m1= 7
k1={2,3,4,10,11,12}

m2 = 25
k2 = {20,25,30}

so again we got m1= 7 & m2 = 25

Thus we are getting same mean we have to stop.

And the Answer is -
k1 = {2,3,4,10,11,12}
k2 = {20,25,30}          


No comments:

Post a Comment