Algorithm
Initialize k prototypes wj=xp, j∈{1,…,k}, p∈{1,…,P}where we pick random points in the dataset (i.e. k≤P) to initialize each weight. Each cluster Cj is associated with prototype wj while for each xp in input set: put xp in cluster with nearest prototype wj for j in range(k): wj=∣cJ∣1xl∈cj∑xl where cj is the cluster size E=j=1∑kxl∈cj∑∣xl−wj∣2 if(E not increasing): break