A competitive network in Lisp

Code: competitive-ann.lisp

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 learning-rate.

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 cluster-centroid.

A Wikipedia article about competitive networks:

Published in: on 21/01/2013 at 14:55  Leave a Comment  

The URI to TrackBack this entry is: https://burubaxair.wordpress.com/2013/01/21/a-competitive-network-in-lisp/trackback/

RSS feed for comments on this post.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: