Skip to content

Implementing Self Organising Maps from Scratch, an Unsupervised Machine Learning Algorithm where we map a high dimensional vector to a 2D space

Notifications You must be signed in to change notification settings

Pranav1007/SOMs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Self Organizing Maps (SOMs)

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:

2000 Iterations 2

You can refer to this Notebook for the implementation

Applications of Self Organizing Maps

  • Clustering Problems
  • Dimensionality Reduction
  • Visualising Higher Dimensions in 2D space

Examples of Colour Quantization using SOMs:

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.

Image1

Image2

Image3

How to Use the Repo and obtain these Images in your Local Device

  • 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

About

Implementing Self Organising Maps from Scratch, an Unsupervised Machine Learning Algorithm where we map a high dimensional vector to a 2D space

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published