Spice Som Guide English

Embed Size (px)

Citation preview

  • 8/3/2019 Spice Som Guide English

    1/14

    Spice-SOM Users Guide 2012-02-07 Page 1

    SPICE-SOM USERS GUIDE

    Cao Thang 2003 2007

    1x ix nx

    1iW

    ijW

    LAYEROUTPUT

    LAYERINPUT

    jNeuron

    1Neuron

    1. INTRODUCTION

    This is a users guide for the Spice-SOM - a Self-Organizing Map (SOM) application. It does

    not intend to introduce about SOM theories. You can find more knowledge about SOM and

    Neural Network (NN) in other textbooks.

    Depending on the version, some contents of this material may be different with your

    downloaded Spice-SOM.

    The purpose of this program is to get you started quickly with Neural Network without having

    to go through lengthy theory of the Neural Network background. Once you understand these

    programs you will be able to consult the Neural Network materials on a need basis.

    Spice-SOM's arm is to introduce NN and SOM to graduated students studying Computational

    Intelligence. Currently Spice-SOM has been using by many students around the world. Spice-SOM has interfaces in Vietnamese, English and Japanese.

    Spice-SOM was written by CAO THANG (http://www.spice.ci.ritsumei.ac.jp/~thangc/) when

    he did researches in the Soft Intelligence Laboratory, Ritsumeikan University, Japan, 2003-

    2007.

    Spice-SOM and Spice-Neuro can be downloaded at

    http://www.spice.ci.ritsumei.ac.jp/~thangc/programs/

    If you have questions or requirements about Spice-SOM, please contact the author at"[email protected]". Thank you.

  • 8/3/2019 Spice Som Guide English

    2/14

    Spice-SOM Users Guide 2012-02-07 Page 2

    2. INSTALL THE SPICE-SOM

    Download setup file of the Spice-SOM and run setup.exe, setup welcome window will appearson the screen.

    Fig. 1. Setup

    Select 'Next', and then select a folder into that you want to install Spice-SOM, select 'Next' and

    'Next', Spice-SOM will be installed into the selected folder.

    Fig. 2. Select Folder

  • 8/3/2019 Spice Som Guide English

    3/14

    Spice-SOM Users Guide 2012-02-07 Page 3

    Note: If the Spice-SOM does not run after installing, you may need to install Microsoft .NET

    Framework Redistributable Package 3.5.21022 before installing Spice-SOM.

    3. USING SPICE-SOM

    Run Spice-SOM by clicking on Spice-SOM icon on your desktop or selecting Start

    Programs Cao Thangs Spice-SOM Spice-SOM.

    First the program runs with the English interface, you can select Vietnamese or Japanese by

    selecting Options Languages.

    Fig. 3. Select language

    Menu About, README first is a briefly introduction about Spice-SOM and Users

    agreements. You should read it carefully before using Spice-SOM.

  • 8/3/2019 Spice Som Guide English

    4/14

    Spice-SOM Users Guide 2012-02-07 Page 4

    Fig. 4. About Spice-SOM

  • 8/3/2019 Spice Som Guide English

    5/14

    Spice-SOM Users Guide 2012-02-07 Page 5

    3.1. Data Preparation

    Using your data by Spice-SOM, you should prepare your data by the following format: data is

    prepared in text format by rows and columns. The first column is ID, then Inputs and finally

    Labels. Values are separated by comma (Comma Separated Value File Format) with CSV filetype, or Tab (Tab Separated Value File Format) with TXT file type. You may use MS Excel to

    edit your data, and then save it in text or csv format. For example data with 5 inputs, 4 datasets

    is organized as shown in Table 1.

    Table 1. Text Data with 5 inputs, 4 dataset

    Note: Data should be numeral, except labels. Spice-SOM cannot read your data if there is a

    blank data or null data.

    There are some good examples in \Data folder of the Spice-SOM:

    number5group1dimension is an example with 100 datasets, 1 input.

    number5group2dimension is an example with 100 datasets, 2 inputs.

    number5group3dimension is an example with 100 datasets, 3 inputs.

    ID X1 X2 X3 X4 X5 LABEL

    0 0 0 0 0 0 Data 1

    1 0 1 1 0 1 Data 2

    2 1 0 1 0 1 Data 3

    3 1 1 0 1 1 Data 4

    ID: ID of Datasets X: Input DataLABEL: Labels of Datasets

  • 8/3/2019 Spice Som Guide English

    6/14

    Spice-SOM Users Guide 2012-02-07 Page 6

    3.2. Load Data

    Suppose that we are using the data in number5group3dimension.txt file, 100 datasets and 3

    inputs.

    Fig. 5. Load Data

    In Number of Input and Data Sets, you should select as illustrated in Fig.5. Then, select

    command button Browse from TEXT files, the data will be loaded into memory. In DATA

    group on the right, you can review each of loaded datasets. If your data is not normalized, you

    may use some normalization functions of Spice-SOM.

    In Tab Data Visualization, you can see graph of all loaded data if the number of data is not

    large, as illustrated in Fig.6.

    Bar for

    Selecting Data

    Normalization Functions

    Input Data (Graph)

    Input Data

    (Table)

  • 8/3/2019 Spice Som Guide English

    7/14

    Spice-SOM Users Guide 2012-02-07 Page 7

    Fig. 6. View Input data

    3.3. Network Training

    Fig. 7. Select learning parameters

  • 8/3/2019 Spice Som Guide English

    8/14

    Spice-SOM Users Guide 2012-02-07 Page 8

    2.3.1. Select Network and Training Parameters

    The training interface of Spice-SOM is shown in Fig.7. Before train your SOM network, you

    should choose its parameters as follows:

    Sigma Max: Maximum value of neighborhood function of a winner neuron.

    Sigma Min: Minimum value of neighborhood function of a winner neuron.

    Sigma Decreasing Rate: Decreasing rate of value of neighborhood function after one

    iteration

    Learning Rate Max: Maximum value of learning rate

    Learning Rate Min: Minimum value of learning rate

    Iterations: Number of iterations or epochs

    Inhibition: Inhibition value of Mexican Hat neighborhood function

    X Neurons:Number of Neurons in x directions

    Y Neurons: Number of Neurons in y directions

    If you select Continue current weights, the network will learn without resetting its initial

    weights. If you select View Graph Online, Graphs of Neighborhood Function and Mean of

    Square Error (MSE) will be shown on learning process, however the network will learn more

    slowly because your computer have to draw the graphs together with to train the network.

    Neighborhood Functions: You should select a type of neighborhood functions. Spice-SOM gives

    you some standard neighborhood functions as Rectangular, Gaussian, Mexican and Linear hat

    functions.

    Select Topology: Default topology of Spice-SOM is Rectangular. You can select Hexagonal

    topology by Checkbox Hexagonal Topology. Distances of neurons in these two topologies are

    different as illustrated in Fig.8.

    HEXAGONAL:O O O O O O O O O

    O O O & & & O O OO O & @ @ & O O O

    O O & @ + @ & O O

    O O & @ @ & O O O

    O O O & & & O O O

    O O O O O O O O O

    RECTANGULAR:O O O O O O O O O

    O O O O & O O O OO O O & @ & O O O

    O O & @ + @ & O O

    O O O & @ & O O O

    O O O O & O O O O

    O O O O O O O O O

    Fig. 8. Rectangular Topology and Hexagonal Topology

  • 8/3/2019 Spice Som Guide English

    9/14

    Spice-SOM Users Guide 2012-02-07 Page 9

    2.3.2. Training

    After selecting suitable parameters, you can train the network. Here are main command buttons:

    Training: Start the training process.

    Save Weights to Binary File: Save current network weights to binary file.

    Save Weights to Text File: Save current network weights to text file, you can easily

    check each neuron's weights in this text file.

    Load Weights from Binary File: Load weights from a saved binary file.

    Save MSE Graph to Text File: Save MSE graph data to text file.

    Set Default Value: Set parameters as their default values.

    Table 2 illustrates MSE graph data that is saved in a text file. Table 3 illustrates network weights

    that are saved on a text file.

    Table 2. MSE graph data

    Iteration Error Neighbor Distance Learning Rate

    0 10.02597948 10 0.0991

    1 4.14776422 9.9 0.0982

    2 3.42406203 9.8 0.0973

    3 3.378296441 9.7 0.0964

    4 3.256567794 9.6 0.0955

    5 3.209400383 9.5 0.0946

    95 1.018524437 2 0.0136

    96 1.011947207 2 0.0127

    97 1.007276918 2 0.0118

    98 1.002205101 2 0.0109

    99 0.998116728 2 0.0100

  • 8/3/2019 Spice Som Guide English

    10/14

    Spice-SOM Users Guide 2012-02-07 Page 10

    Table 3. Network weights in text file

    Neurons Input0 Input1 Input2

    Neuron Y = 0, X = 0: 36.99527651 40.76692789 37.21308

    Neuron Y = 0, X = 1: 36.85168189 40.01821143 36.97461

    Neuron Y = 0, X = 2: 36.36203974 39.09389637 36.61739

    Neuron Y = 0, X = 3: 35.27379557 38.58864861 36.22565

    Neuron Y = 19, X = 16: 19.76819369 5.711848278 3.108250741

    Neuron Y = 19, X = 17: 17.5739719 6.150696979 3.292584748

    Neuron Y = 19, X = 18: 12.60898022 6.978729306 3.15416311

    Neuron Y = 19, X = 19: 8.678481001 7.590027624 2.853186784

    4. Data Distribution Map

    After the network learning, you can see the data distribution map in Tab Output Distribution

    Image as illustrated in Fig.9. On the map, neurons are arranged in rows and columns. Click

    mouse on a neuron position, in the detailed neuron window you will see labels of data that are

    fallen on this neuron. You can also see distances from selected neuron (by clicking left mouse

    button) to its neighbor neurons.

    You can display blank neuron color, winner neuron color, or distance color between neurons.

    The distance color between two neurons is distance between them displayed by grayscale with

    value 0 (farthest) and 255 (closest). Color of a neuron is an average of distance colors from this

    neuron to its adjacent neurons. Gray color between two neurons presents the distance color

    between them.

    The options for displaying distribution map are the following.

    View detailed on left bottom: Put the detailed window on the left bottom

    View detailed on right top: Put the detailed window on the top right

    Keep Previous Connections: Keep current connections while viewing new connections

    from new selected neurons

    Distance Color: Select gray level for distance color.

    Distance Line: Select value level for displaying connections on the map.

    Map Scale: Select scale of the map on the screen.

  • 8/3/2019 Spice Som Guide English

    11/14

    Spice-SOM Users Guide 2012-02-07 Page 11

    Show Output Map Options: Display options for distribution map:

    o Image Width, Image Height: Size of the map that you want to save (in case you

    want to resize the map).

    o Image Format: Format of the saved map (JPG, PNG, BMP)

    o Print Neuron Number: Print orders of neurons on the map

    o Fill Blank Neuron: Print distance color of blank neurons.

    o Fill Winner Neuron: Print distance color of winner neurons.

    o Show Distance Color: Print distance colors between neurons.

    o Save Original Size: Save the map with original size.

    o Show Hexagonal Topology: Select hexagonal topology for the map (default is

    rectangular topology).

    Select the command button Save Output Image, the output map will be saved on hard disk.

    Figs.10 and 11 show an example of output map.

    You can view the output table by selecting the Tab Output Distribution Table, as illustrated in

    Fig.12. You also can save this table by command button Save Output Table. After re-training

    the network, you need to choose command button Refresh Output Table.

  • 8/3/2019 Spice Som Guide English

    12/14

    Spice-SOM Users Guide 2012-02-07 Page 12

    Fig 10. Output map (hexagonal topology)

    Fig. 9. Output map after learning

    Detailed of

    selected neuron

    Distance from a neuron to its

    neighbor neurons

    Options for output

    map

    Gray color on a neuron

    demonstrates its distances to

    adjency neurons

    Gray color between two neurons

    demonstrates their own distances

    Selecting bars for distance color and

    distance line values

    Save current output map

  • 8/3/2019 Spice Som Guide English

    13/14

    Spice-SOM Users Guide 2012-02-07 Page 13

    Fig 11. Output map (Rectangular topology)

    Fig 12. Output Table

  • 8/3/2019 Spice Som Guide English

    14/14

    Spice-SOM Users Guide 2012-02-07 Page 14

    5. Conclusions

    This material guides you to use Spice-SOM, a Self-Organizing Map application. Having used

    this application, you may have a better understanding on Self-Organizing Map. Like Spice-

    Neuro (a Multi-Layer Neural Network Application), you can use Spice-SOM to model various

    data in different practical domains such as pattern recognition, clustering, decision making... The

    author hopes that Spice-SOM would be useful for your study and research.

    Thank you for using Spice-SOM. If you need more functions in Spice-SOM, please do not

    hesitate to contact author at [email protected]. Your ideas and requirements are

    always welcomed.

    Thank you!