|
In this example you will train a network with the xor function.
The xor function has the following truth table.
|
a
|
b
|
xor
|
|
0
|
0
|
0
|
|
0
|
1
|
1
|
|
1
|
0
|
1
|
|
1
|
1
|
0
|
Neural networks are trained by experimental data. You have to feed them with a training file which will contain data in a special csv format.
Load Microsoft's excel, set up a new worksheet and write the above numbers as in the next figure
Note that the first row contains information about the kind of variable the column represents. "I" stands for input and "O" for output. This format is necessary for to program to receive information about the kind of data to process. Case is not crucial.
If you don't have Microsoft Excel open notepad and write the training file as in the figure
|

|
Save the file with a name xor.csv; as a csv file format
Load BrainCom neural network if not already loaded.
Click on the Menu item Network -> New
A new form appears asking the topology of the network, either one hidden or two hidden layer network. Click ok accepting the default option for one hidden layer network.
Click the button "Training" at the Data files groupbox and import the xor.csv file you just created with Excel or Notepad. You can see at the "Network status" groupbox that the training file has two inputs for the xor function one output and four samples to train. The
"Hidden layers" groupbox contains two parameters. "FHL" label stands for first hidden layer nodes and determines how many hidden nodes will be used. Set this parameter to 4. We selected One hidden layer topology so the "SHL" second hidden layer nodes is disabled. Note that the parameters inputs, Outputs and Samples can not be changed and determined only by the training file.
The groupbox "Training parameters" contains the "momentum" and "rate" parameters which left as they are.
Go to the stopping condition groupbox and set "iterations" to 10000, "tolerance" to 97 and "% correct" to 100 and check the box left to "% correct"
Now you are ready to train the network. Click Task -> Start training or press the button on the tool bar and training begins.
At "Network status" you can see the progress of your network and factors such as the current iteration being processed the total error the topology you selected and time and date features.
You can stop the training process any time by clicking on the menu items task
-> stop training change a parameter that can be changed and restart training.
You can also save the network's matrix after stopping training, save the network, and continue the training another time.
When the stopping condition meets the training stops. You can then save the network by clicking network
-> Save.
Then you have to make an input file to check how the network responds to input data. Again with excel or with any other spreadsheet supporting csv files or notepad make the next file as shown in then next figure
|

|
and save it as xor-input.csv. Then click on the Input button in the "Data files" groupbox and import the xor-input.csv you've just created. In order to compute outputs from an input data file click on menu items task
-> compute outputs and outputs are computed. You can see the training data set and the outputs derived by the input data set by click respectively the menu items view
-> training set and view -> prediction set as in the following figure.

You can see there how close the network has evaluated the output variables in comparison to the training set. You can then save the prediction data set by clicking the menu items Data set
-> Save prediction.
|