next up previous contents
Next: Combining classifications Up: Data reorganization Previous: Convert a classification into

Converting SOM classification to location codes

  

loccode Generate location codes from a field containing neuron numbers
-f <infield> source field
-fout <outpref> prefix for output data field(s)
-l <layer> layer of the original SOM

Generate a hierarchical location code from a data field containing SOM neuron classification numbers. Resulting codes indicate, into which quarter and subquarter and so on, data records have been captured. Each division into four parts increases the length of the code by four bits. Therefore, the codes are 24 bits for the 6th layer of TS-SOM, for example. There is only a single bit difference between codes of neighboring neurons. The code is packed into variables <outpref>_0, <outpref>_1, ... each containing 24 bits of information. The following figure illustrates the coding scheme using the third layer.

figure1160

Example: See the example of lcode2bin.

lcode2bin Convert location codes into binary fields
-f <infield> source field prefix
-dout <frame> output data frame for binary fields
-bits <numbits> number of bits in location codes
[-grps <grpsize>] number of bits in each group
[-wght <residual>] residual to be used for neighbors of 1s

This command converts a "24 bits/variable" location code into binary variables, which are put into the output frame. The number of bits in the whole code needs to be specified and the number of input fields can be calculated from that. Input fields need to be named as <inpref>_0, <inpref>_1, and so on. It is possible to have an additional weighting for the neighboring 0 bits of 1s and, if group size is specified, the neighborhood is determined within each group.

figure1179

Example: If we have a SOM classification in cldata, the original data in frame tdat and TS-SOM layers in soml, with the following commands we can create a location code from the 6th layer into frame lbin and have a weighting of 0.3 for neighbors in each group of 4 bits.

# Select the classification of the 6th layer of TS-SOM
# into a new cldata
NDA> selcld -c cldata -cout clsel -expr 'soml' = 6;
# Convert classification into a data field
NDA> cldind -c clsel -d tdat -fout tdat.somind
# Create location codes for each neuron into tdat.lcds_0
NDA> loccode -f tdat.somind -fout tdat.lcds -l 6
# Convert these codes into a weighted "binary" frame lbin
NDA> lcode2bin -f tdat.lcds -dout lbin -bits 24 -grps 4 -wght 0.3


next up previous contents
Next: Combining classifications Up: Data reorganization Previous: Convert a classification into

Anssi Lensu
Thu May 17 15:00:44 EET DST 2001