| Neural Network Toolbox | ![]() |
Create a Hopfield recurrent network
Syntax
Description
Hopfield networks are used for pattern recall.
net = newhop creates a new network with a dialog box.
newhop(T) takes one input argument,
T - R x Q matrix of Q target vectors. (Values must be +1 or -1.)
and returns a new Hopfield recurrent neural network with stable points at the vectors in T.
Properties
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.
Examples
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); Y
To see if the network can correct a corrupted vector, run the following code, which simulates the Hopfield network for five time steps. (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.
Algorithm
Hopfield networks are designed to have stable layer outputs as defined by user- supplied targets. The algorithm minimizes the number of unwanted stable points.
See Also
References
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.
| newgrnn | newlin | ![]() |