November 2001
In absence of a help facility in this WinSOM Beta version, here below is a short report on how to get started.  Users who are familiar with Kohonen SOM can skim through this document

Kohonen SOM
There is a vast amount of information available on the Internet on this topic.  In a nutshell, SOM (Self Organizing Maps) are used to project a nD space over a 2D space.  In doing so, it tries to preserve essential features of the originating figure. In other words, it will attempt to reduce dimensionality of the input data and organize it in clusters on a 2D map. Another way to look at SOM is as an unsupervised classifier.  Indeed data will “naturally” find their way in the most appropriate cluster.
There are various applications of this reduction of dimensionality in picture compression (although there are better faster ways of doing this), contour recognition, and various sorts of feature extraction.  Regardless of the theoretical background, it is commonly used to cluster and classify data.  In trading, one could imagine an historical data file containing a list of stocks the following information: forward P/E, Sharpe Ratio, Beta, etc… WinSOM could then be used to group stocks with similar features into appropriate clusters to assist in picking stocks or better diversifying a portfolio.  A few samples will be later added.  Please note that scaling or standardizing your data set, while not required, might help significantly the clustering process.

Files needed:
The first thing needed is a set of data (training file) one wishes to organize in clusters.  Training files can be any text file (with a TRN extension) containing the patterns to classify.  Patterns contain the coordinates in the N-dim hyperspace, with or without a preceding pattern index or pattern number.  The program should take care of most if not all possible delimiters (tabs, spaces, commas …) separating the coordinates.  As training is said to be unsupervised, the training file does use a desired output, unlike feed-forward MLPs for instance.

WinSOM will generate a few files while organizing data:
●	One or more cluster maps will be created during training. Cluster maps are grids drawn between centers of each cluster.  In a way, as one keeps a cluster center representing each cluster population, one has “compressed” the data, while trying to preserve the essential features of the original figure.  By recording more cluster maps, one can display how the process progresses (feature movie). In most cases, one shall however only use the last cluster grid.
●	A Output file will be created at run-time. The output file records the cluster coordinates for patterns fed into the SOM neural network.  One can obviously use the training file to see where the patterns now belong, or any new set of data, once one is satisfied with the quality of clustering.
●	A WinSOM Kohonen neural net file is saved, so that the net can be called up again at a later stage.
●	A WinSOM Quantization Report is processed to display and save the quantization error (QE) for each pattern run through the WinSOM net, as well as the average and standard deviation QE for each cluster.  Quantization Error is simply the n-dim Euclidian distance the cluster centre.  Distances between cluster centres are also calculated and saved.

Dimensions
The 2nd tab “Patterns and Map Sizes” sets the projection information: i.e. the dimension of input data, and the size of the cluster map.  The size of the cluster map has a direct impact of convergence speed, so the cluster grid dimensions should be kept reasonable if possible.  It goes without saying that clustering error tends to decrease with the number of clusters.  If a pattern identifier is present in the data, it must be declared here so that WinSOM does not take that pattern index as an extra dimension.

Training Parameters:
Up to 5 convergences stages can be set up.  One is usually not enough unless the data can be easily separated.  More generally, one uses a first stage called “Ordering”, and a second stage “Convergence”.
The first parameter is the Initial Learning Rate (ILR), ranging from 0 to 1.  In most cases, the ILR must be kept low. The learning rate will gradually decrease during the organizing process.  A Final Learning Rate can be set or be left blank (i.e. 0).  Range boundaries are not checked.
The other important parameter is the Initial Neighborhood Size (INS). Without going into details, the neighbourhood means that during the convergence process, when a cluster is found to be the most suitable for a particular pattern, all neighbouring clusters also participate in the convergence process i.e. remain potential candidates.  The neighborhood is also gradually reduced, until only one cluster can be chosen with more certainty.  Depending on the complexity of the problem, one may start with an INS of 50 to 90% of the largest grid dimension, at least at the “Ordering” stage, and 20% to 50% for subsequent stage(s).  The neighbouring function is the common “bubble”, i.e. all or nothing: clusters within the current neighbouring range participate in the learning process, others not.  A smoother Gaussian function is sometimes used, but has not yet been implemented here.
The number of iterations per convergence stage must be set, in the region of 500 to 2000 for the initial stage, and many more for the subsequent stage(s), i.e. up to 5000 or 10000 iterations.  If patterns are difficult to cluster, a low learning rate, and a very high number of iterations will be needed.  Processing time can therefore sometimes be very long.
There are 4 neighborhood reduction functions. For the time being, one can leave that field empty (or set to 0) for a standard inverted decline (1/n function, with n being the current iteration number).
The 4 functions are to be used by their numbers:
0	Standard Inverted Decline (default)
1	Straight Decline (Neigh Dec Interval must be set)
2	Exponential Decline (shallower, useful when ordering)
3	Square Root Decline (steeper)
(See accompanying spreadsheet to better visualize neighbourhood descent)

A display interval can also be set to monitor current iteration, learning rate and neighbourhood size. A gauge bar does provide progress indication anyhow.

Training can be interrupted at any stage. The current WinSOM net and cluster grid will be saved.

Run Parameters

Running the WinSOM net on either training data or new data is extremely fast. Output can be composite, if the objective is merely a classification, or XY coordinates, to know the exact cluster the pattern goes into.  To run the Quantization Report, it is imperative, that XY coordinates are calculated, and the output files must contain all pattern details.

All files created by WinSOM are plain text files with a tab delimiter, and can be easily imported into a text editor or Microsoft Excel.  The preview facility on the right-hand side may not always display columns properly, the reason being that all calculations are performed with “double” precision, and figures are raw, i.e. not rounded, nor clipped.

Graphics

A very primitive cluster grid visual display is provided within WinSOM for 2D patterns only.  A 3D display utility is also provided separately.  More advanced graphics will be added in the next releases.

Practising with WinSOM

Kohonen SOM often requires long experimentations as there is no way to predict optimal parameters.  Launching WinSOM is however somewhat easy.  Once the training file is selected, the file structure is usually detected, and one can just press the “Load Data” button to load patterns in the program’s memory.  One can then go onto the “Patterns & Map Sizes” tab and set the cluster grid size.  The grid is square by default, but you can set it rectangular, and it is actually recommended to do so.  Next is the setting of training parameters. In most cases, only the Initial Learning Rate, the Initial Neighbourhood Size and the Number of Iterations must be set for each convergence stage.  Training can then start.

Final Note
WinSOM is quite computing intensive. Every effort has been made to ensure other concurrent processes get a fair share of the processor, but other applications may seem to freeze on slower machines.  WinSOM should therefore be the only application to run whenever possible.  To display WinSOM properly, a min. screen resolution of 1024x768 is recommended.

ForeTrade