The program performs vector quantization by utilizing a neural network with a competitive layer containing a number of neurons equal to the number of clusters.
Every competitive neuron corresponds to a separate cluster and its weight vector corresponds to the centroid of the cluster.
First, the weight vectors are initialised to random values.
Then, in each epoch, the set of input vectors is presented to the network.
For each vector in the input set, the distances between it and each competitive neuron’s weight are calculated and the winner neuron is selected.
The winner is the neuron whose weight vector is the most similar to the input vector.
I use 1/(1+d) as a similarity measure, where d is the Euclidean distance.
The winner’s weight vector is updated by “moving” the winner neuron’s weigth closer to the input vector.
The amount of the moving depends on the
After running the user-specified
number-of-iterations, the program outputs the final weight vectors which are the centroids of the clusters.
Then you can take an arbitrary vector and check to which cluster it belongs by using the function
A Wikipedia article about competitive networks: