Input: Dataset, |
Output: Clusters |
() Select initial centroids of clusters randomly. |
() Assign every instance Dataset to the closest centroid to make clusters |
() Calculate cluster centroids , |
() For every instance Dataset Do |
() Reassign to closest cluster centroid; is moved from to |
If , . |
() Recalculate centroids for clusters and . |
() If cluster instances are stabilized Then stop Else go to Step (). |