Neural Network Toolbox | Search  Help Desk |
newhop | Examples See Also |
Create a Hopfield recurrent network
net = newhop(T)
Hopfield networks are used for pattern recall.
newhop(T)
takes one input argument,
T - R
x Q
matrix of Q
target vectors. (Values must be +1 or -1.)
T
.
Hopfield networks consist of a single layer with the dotprod
weight function, netsum
net input function, and the satlins
transfer function.
The layer has a recurrent weight from itself and a bias.
Here we create a Hopfield network with two three-element stable points T
.
T = [-1 -1 1; 1 -1 1]'; net = newhop(T);Below we check that the network is stable at these points by using them as initial layer delay conditions. If the network is stable we would expect that the outputs
Y
will be the same. (Since Hopfield networks have no inputs, the second argument to sim is Q
= 2
when using matrix notation).
Ai = T; [Y,Pf,Af] = sim(net,2,[],Ai); YTo see if the network can correct a corrupted vector, run the following code which simulates the Hopfield network for five timesteps. (Since Hopfield networks have no inputs, the second argument to sim is
{Q TS} = [1 5]
when using cell array notation.)
Ai = {[-0.9; -0.8; 0.7]}; [Y,Pf,Af] = sim(net,{1 5},{},Ai); Y{1}If you run the above code,
Y{1}
will equal T(:,1)
if the network has managed to convert the corrupted vector Ai
to the nearest target vector.
Hopfield networks are designed to have stable layer outputs as defined by user supplied targets. The algorithm minimizes the number of unwanted stable points.
sim
,
satlins
Li, J., A. N. Michel, and W. Porod, "Analysis and synthesis of a class of neural networks: linear systems operating on a closed hypercube," IEEE Transactions on Circuits and Systems, vol. 36, no. 11, pp. 1405-1422, November 1989.