Professional Documents
Culture Documents
Networks (3) ur
co www. http://
w
eb
compi rg
nt/pag u.ac.uk/eng
sit
e.cfm? /
pge=6
e
732
This month we look at two more advanced neural nets. The Hopfield
network, which uses feedback in its structure, and the Competitive net
which can recognise patterns in data, even if the programmer doesn’t
know they exist.
Forward pass operation fed back to the input once it’s been
Feedback paths calculated and so goes through the
The neurons operate in the same network again. Eventually, if the
way as the binary ones described in network has been trained properly,
Input Output 1
part 1 (except that they produce a the output will become constant
A
–1 and +1 output, rather than 0 and (the inputs and outputs will be the
1). The only difference in operation same). The network is said to have
is that the output of the network is relaxed. The network is then ready
Input
B Output 2
Start – Apply
020324 - 3 - 11 initial inputs to
network
Figure 1. A Hopfield Net.
for you to read its outputs. Figure 2 the Hopfield network can do, which Where Wm,n is the weight of the connection
shows this process in the form of a the BP network can not. A Hopfield between the mth input and the nth neuron
flow chart. network, rather than just recognis- and On is the nth output desired from the net-
ing an image, can store and retrieve work.
patterns — it has a memory. We can In other words, to find the weight of the
Uses input a corrupted image into the connection between input m and neuron n,
Before going any further, it’s worth network and it will reproduce the take each pattern to be trained in turn and
pausing to consider what it is that perfect stored version. Figure 3 multiply the mth output by the nth output and
add them all together. As usual this is best
illustrated by example, see Figure 5.
Let’s say we’d like to train three patterns:
w1,1 = 0
3 OC w1,2 = OA(1) × OB(1) + OA(2) × OB(2) + OA(3) ×
w3,3 OB(3) = (–1) × (–1) + 1 × (–1) + –-1) × 1 =
020324 - 3 - 15 –1
w1,3 = OA(1) × OC(1) + OA(2) × OC(2) + OA(3) ×
OC(3) = (–1) × 1 + 1 × (–1) + (–1) × 1 = –3
Figure 5. Worked example of Hopfield training.
{
ward net if the feedback paths are weights are random), one of these
set to zero. neurons will have a higher output Input 2
You might guess therefore, that than the others — let’s say it’s neu-
the most general neural nets would ron three, as shown in Figure 8.
have a mixture of both feedback and We say that this neuron has won
020324 - 3 - 19
feedforward connections. In fact this and set its output to 1 and the oth-
is true. In the most general network, ers to zero.
any neuron could be connected to Now we train only the weights of Figure 9. The inputs shown on a graph.
any other, Figure 6 shows the idea. neuron 3 (the ones shown in bold),
Training such networks is tricky, so that, if this pattern comes along
as algorithms like the Hopfield Train- again it will have an even higher out-
ing illustrated above and even Back put — it will win even more easily.
Propagation only operate when the So neuron three will always fire Weight vector length W
network has a defined and limited
structure. To train a network where
any neuron may be connected to any
when this pattern comes along. In
other words, neuron three recognises
the pattern. This is very simple to
Weight 1 { Input vector length L
{
other demands more advanced algo- do; we just update the weights with Weight 2
rithms. this formula:
Perhaps the easiest algorithm to
employ and certainly the most com- W+ = W + η(Input – W)
mon in such circumstances is the 020324 - 3 - 20
Genetic Algorithm. One can employ Where W+ is the new (trained
the algorithm to choose the weights weight) and W is the original
in a general network in the same weight, Input is the input feeding Figure 10. The weight vector of neuron 3.
way as one can use it to choose com- that weight and η is a small con-
ponent values in the examples given stant, much less than 1 (say 0.1).
in that article, the fitness of the net- Of course if another, completely (even although the similarity may not be obvi-
work being the inverse of its error. different, pattern comes along a dif- ous to the user). We can say therefore that,
The details of such advanced train- ferent neuron will win and then this whereas the Back Propagation network is
ing methods can wait for a future new neuron will get trained for that trained by the user to recognise patterns, the
article. pattern and so the network self Competitive net trains itself to classify pat-
organises so that each neuron fires terns.
for its own pattern. Of course you could use the competitive
Competitive Learning neuron to recognise patterns like Back Prop-
Now, let’s look at a quite different agation. But this seems rather a waste of
network. You’ll remember that in Uses effort since BP works extremely well and is
part 2, we mentioned that probably Suppose we let a competitive net- generally easier to set up than a competitive
80% of neural nets used in practice work loose on some data — let’s say net.
were Feedforward, Back Propagation from the financial markets. The net-
nets. This leaves the question of the work would organise itself to find
remaining 20%. Well, most of these patterns in the data. Exactly what More detail
are of a type of network known as a these patterns are, we don’t know, To understand some of the subtle features of
Competitive or Winner-Takes-All the network decides for itself — we the competitive system, we need to examine
Net. don’t give it examples like a Back its operation a little more closely. To do this,
Propagation network. This is both let’s look at the network shown in Figures 7
the attraction and the disadvantage and 8 more closely.
Operation of the Competitive network — you The network has two inputs and it’s pos-
The Competitive net is best illus- might find an important pattern in sible to represent these as a line (called a vec-
trated by example. Suppose we have the data which you didn’t know tor) on a graph, where y is the value of input
a network of three neurons as shown existed — but it could miss what 1 and x input 2. This is shown in Figure 9 (of
in Figure 7. you’re looking for and find some course this applies to any number of inputs,
The neurons work in exactly the other unwanted patterns to recog- but two are easy to visualise).
same way as those already nise. The length of this vector by Pythagoras is:
described in part 1, except that we In the same way and related to
don’t need to apply a threshold or this, the network will fire the same Length = ( input1) 2 + ( input 2) 2
sigmoid function. neuron for patterns it finds similar