Self-Organizing Maps or SOMs is an Unsupervised Machine Learning Algorithm which reduces the dimensionality of the input so as to represent it in a map.
It is very similar to the general Artificial Neural Network, but with one small tweak. Unlike an ANN, which learns by backpropogation, SOMs, implement the concept of Competitive Learning to learn the weights. In Competitive Learning the Output Neurons of the hidden layer compete amongst themselves to be activated, and there can only be one neuron that can be activated at any given time.
This algortithm was invented by Teuvo Kohonenin the 1980s and is sometimes called Kohonen Maps.
With the help of Python, I have implemented the working of a simple Self-Organizing Map where I'll be using a dataset of random colours which are represented as 3D vectors (Each colour of the vector representing R,G,B values) and visualise the different clusters we can form with it in a 2D space.
It will look similar to this:
You can refer to this Notebook for the implementation
- Clustering Problems
- Dimensionality Reduction
- Visualising Higher Dimensions in 2D space
With the help of the MiniSom Library I have implemented a colour quantization model. Basically, this model will use Self Organizing Maps to reduce the number of distinct colours present in the image in such a way that the new image is still visually similar to the original image.
- Clone the GitHub repository
$ git clone git@github.com:Pranav1007/SOMs.git
- Move to the SOMs Directory
$ cd SOMs
- All the requirements and dependencies need to be installed.
$ pip install -r requirements.txt
- Run the test file now to see the Colour Quantized Image
$ python test.py