Learning Vector Quantization
Learning Vector Quantization
Learning Vector Quantization
if correctly_classified:
wij(new) = wij(old) + alpha(t) * (xik - wij(old))
else:
wij(new) = wij(old) - alpha(t) * (xik - wij(old))
Algorithm:
from a given set of training vectors, take the first “n” number of
clusters training vectors and use them as weight vectors, the
remaining vectors can be used for training.
D(j) = ΣΣ (xi-Wij)^2
Step 4: Check for the stopping condition if false repeat the above steps.
Python3
import math
class LVQ :
D0 = 0
D1 = 0
if D0 > D1 :
return 0
else :
return 1