High level Implementation Of Simple Self-Organzing Map (Kohonen Map)
follow by the instruction on the ai-junkie website : https://www.ai-junkie.com/ann/som/som1.html
This is the second task on ICCS internship program at TU-Chemnitz , Germany
by Theppasith Nisitsukcharoen
Third-year Computer Engineering student , Chulalongkorn University
Desktop Side
- Windows 7 (According to serial transmission Library)
- SFML Library - Draw Visualization
- SFML -Please Select 32-Bit - code:block set path to = C:\SFML-2.3
- CODE::BLOCK (IDE for C++/C) - Project files formatted for code:Block
Microcontroller Side
- Source-Code here SimpleSOM-MSP430
- MSP430F5529 Board (Texas instrument)
- Code Composer Studio (Texas instument modded version of Eclipse)
- First, you have to clone this repo into your computer.
- You can use SOURCETREE or any git clients you want to.
$ cd path/to/your/workspace
$ git clone https://github.com/Tutorgaming/SimpleSOM-junkie.git
-
Add "C:\SFML-2.3\bin" to WINDOWS PATH
-
Then Open the project file using Code::Block [Tutor-SOM.cbp]
-
Here you go :D
- Normally , the test dataset is set to "iris.data" which is located on root directory of the project file.
- There are some flag to set before compiling
/*================================
@FLAG
==================================*/
int serial_flag = 1; //Enable Serial
int finished = 0;
int classy = 0;
int num = 0;
int plotty = 0;
- Also the Parameters for self organizing map network
/*================================
@PARAMETERS
==================================*/
unsigned const int ROW = 15;
unsigned const int COL = 15;
unsigned const int MAX_ITERATION = 250;
double MAX_radius = max(ROW, COL)/2;
const double LEARNING_CONST = 0.1;
- Program will count lines and elements of the dataset.
- After that, it imports dataset onto those vectors
- vector <double> data
- vector <double> real
- Next , create the self-organizing network with randomized weight
- User will prompt to press "ENTER" in order to start program
- Traning Process - Bring the dataset from vector <double> data one by one to train the network until the end of dataset
- Shuffle Dataset (vector <double> data)
- Do Training Process until reach the iteration round ( according to MAX_ITERATION )
- After training , Plot the dataset on the trained map ( to specify which region are the data )
- Use plotter[Row][Col]
- Sending the trained Self-Organizing network to Microcontroller ( according to serial_flag )
- Running Microcontroller is required
- function " sentMapToMSP(); "
- Finally, the program will ask the input test vector ( its size depends on elements of dataset ) and send it to microcontroller
- The Result
- Shown on the console (Desktop Side)
- Blinking LED on microcontroller ( numbers depends on the class tag )