Kohonen self organising maps for music clustering in Python
This repo contains a general implementation of Self Organising Maps in Python.
This repo also contains scripts for experimenting with the GTZAN Dataset containing 30-second music tracks categorised by genre. Download the dataset here.
To use the dataset, extract the files and use the createh5.py file to extract features using Librosa and create a .h5 file containing the training set. Usage:
python createh5.py /path/to/GTZAN filename.h5
The SelfOrganisingMap
class has been implemented as a general class to use in your Python experiments independantly from your data. Simply instantiate an object passing the dimension of the map and the dimension of the feature vector.
E.g. using MNIST dataset on a 16x16 Kohonen map
from som import SelfOrganisingMap
map = SelfOrgansingMap(16, 784)
The SelfOrganisingMap
class is using the Gaussian function to scale neighbors.
For more info on how Kohonen Self Organising Maps work, refer to this short tutorial.