Example of Kohonen working as a Self-Organizing Map.
The implementation of Kohonen is a modified version of MiniSom. The difference is an exposed method to apply the training in steps to be able to hook up to that and visualize the process.
Create a virtual environment and install all dependencies:
virtualenv .env
source .env/bin/activate
pip install -r requirements.txt
To run the method, the command is:
python main.py -n KOHONEN_SIZE -it ITERATIONS -nd SPACE_POINTS -fig grid|circle|triangle|random-circle -line
-n
--> Size of the network (n x n)-it
--> Number of iterations to use-nd
--> Total points to attempt to adjust to (should be perfect square, ie, 25, 36, 49, etc) within the range[-1, 1]
-fig
--> Point distribution to use.-line
--> Enables or disables drawing lines between Kohonen points.
Example call:
python main.py -n 5 -it 3000 -nd 25 -fig grid
To run the method, the command is:
python image_to_gif.py -f FOLDER_PATH -s STEPS_IN_GIF
-f
--> Path to folder with images-s
--> Frames to skip in every iteration, it's the step
Example call:
python image_to_gif.py -f results/5-3000-25 -s 10
To run the method, the command is:
python image_to_video.py -f FOLDER_PATH -s STEPS_IN_GIF -fps VIDEO_FPS
-f
--> Path to folder with images-s
--> Frames to skip in every iteration, it's the step-fps
--> FPS for the video
Example call:
python image_to_video.py -f results/5-3000-25 -s 1 -fps 60