Given Cm={y1(m),…,yN(m)}, use the NN condition to form the optimal partition Ri(m)={x:d(x,yi(m))≤d(x,yjm), j=1,…,N} i=1,…,N(*)
Determine Cm+1={y1(m+1),…,yN(m+1)} using the centroid condition yi(m+1)=y∈Rargmin E[d(X,y)∣X∈Ri(m)], i=1,…,N Now we have enough to state the Lloyd-Max algorithm
Algorithm
Inputs: pdf f(x), initial codebook C1={y1(1),…,yN(1)}, threshold ϵ>0. Set m=1 and D1=E[d(X,Q(1)(X))].
Given Cm, perform the Lloyd Iteration to get Cm+1
Compute Dm+1=E[d(X,Q(m+1)(X))] If DmDm−Dm+1<ϵthen output Cm+1 and stop. Otherwise m:=m+1 and go step 2.