What really happens in SOM?
Each data point in the data set recognizes themselves by competing for representation. The procedure of the SOM mapping starts from initializing the weight vectors. Then a sample vector is selected randomly from the previous step and the map of weight vectors is searched to find which weight best represents that sample. Each and every weight vector that is present there, has neighboring weights that are close to it. The chosen weight is then rewarded by being able to become more like that randomly selected sample vector. The neighbors of that particular weight are also rewarded by being able to become more like the chosen sample vector. This then allows the map to grow and form many different shapes.
For the full implementation of SOM in python, refer the following link:
https://visualstudiomagazine.com/articles/2019/01/01/self-organizing-maps-python.aspx