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
2. m2 = 12 ->
- m1 = 4 ->
- K1 ={2,3,4} Apply - |x1- x|[formula]
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 arem1 = 5k1={2,3,4,10,11,12}m2= 20k2 ={20,25,30}
Again The sum of the above numbers plus division is as many numbers as there arem1= 7k1={2,3,4,10,11,12}
m2 = 25k2 = {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