In Lab 4, one of the provided examples was used to test the SNNS toolkit. In this lab, we will create our own 16-4-16 network using a command-line tool provided by SNNS. A 16-4-16 network uses a similar concept to the 8-3-8 network in Lab 4, but it is larger and takes more time to run.
First, the network file must be generated that says how the network is layed
out. For a 16-4-16 network, we want 16 input nodes arranged in a single layer,
4 hidden nodes arranged in a single layer and 16 output nodes arranged in a
single layer. The input nodes should be fully connected to the hidden nodes.
The hidden nodes should be fully connected to the output nodes. The
command-line tool to create network files is
/ai/snns/bin/ff_bignet
. The syntax is:
ff_bignet -p <layer1_data> ... -p <layerN_data> -l <link1_data> ... -l <linkM_data> <output_filename>The layer data specifies the 2-D arrangement of the nodes in each layer (it is 2-D to support doing Kohonen self-organizing maps). So for a single layer with 16 nodes, the syntax would be
-p 1 16
. The link data specifies how
interconnected the links should be between each layer. To fully interconnect
layer 1 (input) to layer 2 (hidden), the syntax is -l 1 + 2 +
. So
to create our desired network, the command is:
/ai/snns/bin/ff_bignet -p 1 16 -p 1 4 -p 1 16 -l 1 + 2 + -l 2 + 3 + test.netThis creates a 16 node layer 1 (input), a 4 node layer 2 (hidden) and a 16 node layer 3 (output) network. Layer 1 is fully connected to layer 2 and layer 2 is fully connected to layer 3. The network is stored in the file
test.net
(you can rename this file to whatever you wish).
The next step is to prepare the training pattern file. There is not an easy way
to do this from the command line without binary-formatted files. It is easier
to take encoder.pat
and edit it by hand. First, change the number
of patterns, input units and output units at the top of the file to 16. Then
append 0 0 0 0 0 0 0 0
(eight zeros) to each of the existing
patterns. So 1 0 0 0 0 0 0 0
would become
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
for example.
Finally, add eight new patterns corresponding to setting the single bit in
each of these new positions. So for example you would add:
# Input pattern 9: 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 # Output pattern 9: 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0You should have 16 patterns in total when you finish editting the pattern file.
Finally, modify encoder.bat
to use the network and pattern files
you just created. Run the modified bat file using batchman, as described in
Lab 4. This larger network will take longer to run than
the 8-3-8 network, but it should still complete in about 130 cycles.