1 0 0 0 0 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0

advertisement
NNL compiler
User Manual
Contents
Requirements................................................................................................................................................ 3
Layout............................................................................................................................................................ 3
Compiling with the IDE.................................................................................................................................. 4
Training with the IDE..................................................................................................................................... 5
Example ......................................................................................................................................................... 6
Requirements
For application to run Java Development package must be installed on the computer. Further it
is required that javac, Jar and java be set in the OS Path.
Layout
The NNL ID consists of a compile and train area. This is shown in the layout below:
The compiler area consists of three tabs and a compile button. The “Topology Code” tab is for
input of the NNL program. After compiling, by clicking the “Compile” button, code can be viewed in the
“Generated Code” Tab. Compiler details can be viewed in the “Compiler Details” tab.
The Training Section consists of two tabs and one button. The “input” tab is the area in which
desired training data for the generated neural network is placed. The input may be manually typed or
pasted. The output Tab is the output of the neural network based on the input. To perform training, and
populate the output tab, select “Run Network” button.
Compiling with the IDE
First create a neural network in the “topology code” tab. This may be done by manual inputting it or
pasting from another source. Example code is shown below:
Select the “compile” button to compile inputted code. If a syntax error is detected an error will be
displayed under the compiler button as shown:
It is possible that there may be a semantic error. To view semantic errors select the “Compiler Detail”
tab and review the log. For example if a Soma was not combined with a neuron the output would be:
Training with the IDE
After the NNL has been compiled the Network is ready to be trained. To train a network data
must be entered in the input area. Example data is shown below:
After data is entered select the “Run Network” button. If the input file has bad formatting an error will
be displayed under the button. Below is an example:
After the network has processed the input the “output” tab will be populated. Below is an example:
Example
In this example a neural network that detects the letter “L” will be created, trained and tested. To
understand the example we construct two 5 X 5 grids.
Each grid contains the letter L but in different locations. Each square is assigned a binary value:
white=0, gray=1. These values provide a pattern for the letter “L”. Figure patterns are represented in
the table below were V1 and V2 are the values of each image.
#
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
V1 1 0 0 0 0 1 0 0 0 0
V2 0 0 0 0 0 0 0 1 0 0
1
0
1
0
1
1
0
0
0
0
0
0
0
0
0
1
0
1
0
1
0
0
0
0
0
0
The neural network that will be constructed is a twenty five input single layer network. There is
a single output such that 1 represents L found and 0 represents not found. The following is the code for
this network:
/ single layer 25 input network
soma s1 Logistic(10, 2, 5);
// create dendrite with weight
Dendrite d1 Rand(1,2);
Dendrite d2 Rand(1,2);
Dendrite d3 Rand(1,2);
Dendrite d4 Rand(1,2);
Dendrite d5 Rand(1,2);
Dendrite d6 Rand(1,2);
Dendrite d7 Rand(1,2);
Dendrite d8 Rand(1,2);
Dendrite d9 Rand(1,2);
Dendrite d10 Rand(1,2);
Dendrite d11 Rand(1,2);
Dendrite d12 Rand(1,2);
Dendrite d13 Rand(1,2);
Dendrite d14 Rand(1,2);
Dendrite d15 Rand(1,2);
Dendrite d16 Rand(1,2);
Dendrite d17 Rand(1,2);
Dendrite d18 Rand(1,2);
Dendrite d19 Rand(1,2);
Dendrite d20 Rand(1,2);
Dendrite d21 Rand(1,2);
Dendrite d22 Rand(1,2);
Dendrite d23 Rand(1,2);
Dendrite d24 Rand(1,2);
Dendrite d25 Rand(1,2);
// create neuron – new line cannot be entered in middle of a statement
Neuron n1 s1 d1 d2 d3 d4 d5 d6 d7 d8 d9 d10 d11 d12 d13 d14 d15 d16 d17 d18 d19 d20 d21 d22 d23 d24 d25;
/// assing inputs to ids
Sense 1 sens1;
Sense 2 sens2;
Sense 3 sens3
Sense 4 sens4;
Sense 5 sens5;
Sense 6 sens6;
Sense 7 sens7;
Sense 8 sens8;
Sense 9 sens9;
Sense 10 sens10;
0
0
0
0
Sense 11 sens11;
Sense 12 sens12;
Sense 13 sens13;
Sense 14 sens14;
Sense 15 sens15;
Sense 16 sens16;
Sense 17 sens17;
Sense 18 sens18;
Sense 19 sens19 ;
Sense 20 sens20 ;
Sense 21 sens21 ;
Sense 22 sens22 ;
Sense 23 sens23;
Sense 24 sens24 ;
Sense 25 sens25;
// output to id
Result 1 r1;
// connect network
synapse sens1 d1;
synapse sens2 d2 ;
synapse sens3 d3 ;
synapse sens4 d4 ;
synapse sens5 d5 ;
synapse sens6 d6 ;
synapse sens7 d7 ;
synapse sens8 d8 ;
synapse sens9 d9 ;
synapse sens10 d10 ;
synapse sens11 d11 ;
synapse sens12 d12 ;
synapse sens13 d13 ;
synapse sens14 d14 ;
synapse sens15 d15 ;
synapse sens16 d16 ;
synapse sens17 d17 ;
synapse sens18 d18 ;
synapse sens19 d19 ;
synapse sens20 d20 ;
synapse sens21 d21 ;
synapse sens22 d22 ;
synapse sens23 d23 ;
synapse sens24 d24 ;
synapse sens25 d25 ;
synapse n1 r1 ;
After compiling this code the Input field needs to be populated. To train the
network the following data should be copied into the input section several times:
1000010000111000000000000#1
0000000100001000011100000#1
0000001110001000010000100#0
1110001000010000100000000#0
then to get the results the end of the input file should have:
1000010000111000000000000#
0000000100001000011100000#
0000001110001000010000100#
1110001000010000100000000#
Then select “Run Network” button to process input data. The output file is now
populated and should look like:
1000010000111000000000000#1
0000000100001000011100000#1
0000001110001000010000100#0
1110001000010000100000000#0
.
.
.
1 0 0 0 0 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 # 1.0 <---- prediction
0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1 1 0 0 0 0 0 # 1.0 <---- prediction
0 0 0 0 0 0 1 1 1 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 # 0.0 <---- prediction
1 1 1 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 # 0.0 <---- prediction
If the predictions are incorrect then the input training repetitions needs to be
increased.
Download