📄 brain12.doc
字号:
- Biologists using neural networks to model various biological
processes.
The Brain v1.2 - User's Manual Page 8
____________________________________________________________________
Training and Testing The Brain
==============================
Training The Brain
------------------
You can start The Brain in either of two ways:
1) For beginners: Type 'start-me' (without the quotes) at
the DOS prompt. This will guide the beginner through the
included tutorial/demo (see the Tutorial for more
details).
2) For advanced users: Type 'brain12' (without the quotes)
at the DOS prompt. This will start The Brain in normal
mode.
After starting The Brain, the first prompt will ask you to enter the
filename in which the input data is stored. The input file contains
the details about the problem, including the training examples and
the correct output for each example. See the 'Input File Layout'
section for details on creating/specifying input files.
After the input file has been correctly loaded you'll be asked
whether you want to load in a file containing a stored set of
weights. This file must have been created by a previous training
session. NOTE: An error will occur if you try to load a set of
weights saved for a different sized network.
Training of the network will then occur. Updates will be displayed
after every 100 training cycles (i.e. after 100 presentations of the
complete training set). Training is halted when the error result (a
quadratic error function is used) drops below 0.2 or after 10000
training cycles have been processed. Training can be terminated
prematurely by pressing control-c (i.e. while holding down the control
key press the 'c' key). Training times vary depending upon the
network size and the speed of the machine you are using. Large
networks can sometimes take a long time to complete the training
session.
Once training has been completed a prompt appears asking whether you
would like to save the weights. A set of weights is needed for
testing the network. If the network was able to correctly identify
the desired input patterns, and you intend to test the network,
answer "y" to this prompt. See the section on "Testing the
Network".
Testing on unseen data can be carried out once the network has been
trained. Unseen data refers to data similar to but different from
the data used to train the network. For example, if you've trained
The Brain v1.2 - User's Manual Page 9
____________________________________________________________________
the network on your own handwriting, test it with someone else's
handwriting).
Hints on Training a Network
---------------------------
Experimentation is required in order to enable a network to
correctly learn a particular training set. Some networks may learn
a particular problem using only one hidden unit while others may
require 20 or 30 hidden units. The only way to find out is to try
it!
Networks also occasionally become stuck during learning. Either
they take a very long time to learn a problem or they fail
completely; it all depends on the initially chosen values for the
weights. To overcome this problem, simply train the network again.
Since The Brain randomly chooses the initial weights for the network
(assuming you haven't loaded a set of weights), one or more
additional training sessions should find an acceptable starting set
of weights . Restarting the network should solve the problem of the
network becoming stuck.
Research has found that a network performs best on unseen data with
a network using the least number of hidden units that can
successfully learn the training set. If you would like good
generalization on unseen data, train the network using the minimum
number of hidden units that can successfully learn the training set.
If the network is still unable to learn the desired input after
training, try the following:
- add more units to the hidden layer.
- decrease/increase the size of the training set.
- increase the training times.
- alter some of the parameters used in backpropagation (NOTE:
this can only be done in the registered version).
Testing The Network
-------------------
To test a network, start The Brain (by entering 'brain12' at the DOS
prompt). When you are prompted for the input filename, enter the
name of the test input file. A testing input file is almost
identical to a training input file. The main differences are that
you provide testing examples rather than training examples and you
The Brain v1.2 - User's Manual Page 10
____________________________________________________________________
omit the correct output results (The Brain should now be trained to
figure out the correct results on its own). See the 'Input File
Layout' section for details.
After the input file has been correctly loaded, you'll be asked if
you want to load in a previously stored set of weights. Enter 'y',
then enter the name of the file containing the weights. This file
should have been created after successfully completing a previous
training session. NOTE: An error will occur if you try to load in a
set of weights saved for a different sized network.
The inputs contained in the input file will then be fed through the
network using the weights loaded in. The output will be displayed
once all calculations are completed.
An example input file for testing (along with its associated
weights file) has been included with the distribution version
of The Brain:
test123.net Testing data for the numerals 1, 2, and 3.
test123.wts The weights saved after the network was trained to
recognize the numerals 1, 2, and 3.
If the network performs poorly during testing, you can improve its
performance in two ways:
- Add more examples into the training (for example, if you are
training the network to learn handwriting, add handwriting
samples from different/more people).
- Ensure that the network contains the minimum number of hidden
units.
Input File Layout
-----------------
The input file is a text file consisting of (in the following order):
- The unit number for each of the following units:
. the first input unit. (usually 1)
. the last input unit.
. the first hidden unit.
. the last hidden unit.
. the first output unit.
. the last output unit. (a maximum of 30 due to memory
considerations. The registered version uses any available
extra memory to allow for more units).
- The number of training/testing examples.
- Either the word 'test' or the word 'train'. If the input file
The Brain v1.2 - User's Manual Page 11
____________________________________________________________________
represents a training session, 'train' should be used. If the
input file represents a testing session, the word 'test'
should be used.
- The training/testing input data. This must be real
(i.e. decimal) numbers consisting of 1.0 or 0.0 values
('on' or 'off');
- The actual output wanted, which also must be real (i.e.
decimal) numbers. These are omitted if you are just testing
the network.
---XOR Input Example---
The following is an example input file for the XOR problem using a
network with 2 inputs, 2 hidden units, and 1 output unit. The
following example input data is contained in the file 'xor.net',
included with the distribution package.
The XOR (exclusive or) problem is to determine when only one of two
given inputs is 'on' (i.e. The result should be 'on', a 1, if only
one of the inputs is 'on' and produce a result of 'off', a 0, when
the two inputs are either both 'on' or both 'off').
|
O output unit
inputs output / \
0 0 0 O O hidden units
1 0 1 |\ /|
0 1 1 O O input units
1 1 0 | |
XOR Input File
--------------------------cut here--------------------------
1
2
3
4
5
5
4
train
0.0 0.0
1.0 0.0
0.0 1.0
1.0 1.0
0.0
1.0
1.0
0.0
--------------------------cut here--------------------------
The Brain v1.2 - User's Manual Page 12
____________________________________________________________________
---AND Input Example---
The following is an example input file for the AND problem using a
network with 2 inputs, 2 hidden units, and 1 output unit. The
following example input data is contained in the file 'and.net',
included in the distribution package.
The AND function is to produce an 'on' output (a 1) only if both the
inputs are 'on' otherwise produce an 'off' (a 0).
|
O output unit
inputs output / \
0 0 0 O O hidden units
1 0 0 |\ /|
0 1 0 O O input units
1 1 1 | |
AND Input File
--------------------------cut here--------------------------
1
2
3
4
5
5
4
train
0.0 0.0
1.0 0.0
0.0 1.0
1.0 1.0
0.0
0.0
0.0
1.0
--------------------------cut here--------------------------
---Character Recognition Input Example---
This network is designed to recognise the characters 1, 2, and 3.
- If the network has recognised a 1 the 1st output node should
be 'on' (i.e. close to 1.0) and the other output nodes 'off'
(i.e. close to 0.0).
- If the network has recognised a 2 the 2nd output node should
be 'on' (i.e. close to 1.0) and the other output nodes 'off'
(i.e. close to 0.0).
- If the networks have recognised a 3 the 3rd output node should
be 'on' (i.e. close to 1.0) and the other output nodes 'off'
(i.e. close to 0.0).
The network consists of 20 input nodes, 3 hidden nodes, and
3 output nodes. The following example input file is contained in
the file 'char123.net', included with the distribution package.
The Brain v1.2 - User's Manual Page 13
____________________________________________________________________
Character Recognition Input File
--------------------------cut here--------------------------
1
20
21
23
24
26
3
train
0.0 0.0 1.0 0.0
0.0 0.0 1.0 0.0
0.0 0.0 1.0 0.0
0.0 0.0 1.0 0.0
0.0 0.0 1.0 0.0
1.0 1.0 1.0 1.0
0.0 0.0 0.0 1.0
1.0 1.0 1.0 1.0
1.0 0.0 0.0 0.0
1.0 1.0 1.0 1.0
1.0 1.0 1.0 1.0
0.0 0.0 0.0 1.0
0.0 1.0 1.0 1.0
0.0 0.0 0.0 1.0
1.0 1.0 1.0 1.0
1.0 0.0 0.0
0.0 1.0 0.0
0.0 0.0 1.0
--------------------------cut here--------------------------
NOTE: Both the XOR and the AND example training data (described
above) will most likely require a few training runs due to them both
getting stuck. The character recognition training file should learn the
desired output about every time.
The Brain v1.2 - User's Manual Page 14
____________________________________________________________________
Tutorial
========
To demonstrate a use for neural networks let us train The Brain to
learn some numerals, namely 1, 2, and 3.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -