Hopfield neural network was invented by Dr. John J. Hopfield in 1982. It consists of a single layer which contains one or more fully connected recurrent neurons. The Hopfield network is commonly used for auto-association and optimization tasks.

## Discrete Hopfield Network

A Hopfield network which operates in a discrete line fashion or in other words, it can be said the input and output patterns are discrete vector, which can be either binary 0,1

or bipolar +1,−1

in nature. The network has symmetrical weights with no self-connections i.e., **w _{ij} = w_{ji}** and

**w**.

_{ii}= 0### Architecture

Following are some important points to keep in mind about discrete Hopfield network −

- This model consists of neurons with one inverting and one non-inverting output.
- The output of each neuron should be the input of other neurons but not the input of self.
- Weight/connection strength is represented by
**w**._{ij} - Connections can be excitatory as well as inhibitory. It would be excitatory, if the output of the neuron is same as the input, otherwise inhibitory.
- Weights should be symmetrical, i.e.
**w**_{ij}= w_{ji}

The output from **Y _{1}** going to

**Y**,

_{2}**Y**and

_{i}**Y**have the weights

_{n}**w**,

_{12}**w**and

_{1i}**w**respectively. Similarly, other arcs have the weights on them.

_{1n}### Training Algorithm

During training of discrete Hopfield network, weights will be updated. As we know that we can have the binary input vectors as well as bipolar input vectors. Hence, in both the cases, weight updates can be done with the following relation

**Case 1** − Binary input patterns

For a set of binary patterns **sp**

**, p = 1 to P**

Here, **sp**

** = s _{1}p**

**, s**

_{2}p**,…, s**

_{i}p**,…, s**

_{n}p

Weight Matrix is given by

**Case 2** − Bipolar input patterns

For a set of binary patterns **sp**

**, p = 1 to P**

Here, **sp**

** = s _{1}p**

**, s**

_{2}p**,…, s**

_{i}p**,…, s**

_{n}p

Weight Matrix is given by

### Testing Algorithm

**Step 1** − Initialize the weights, which are obtained from training algorithm by using Hebbian principle.

**Step 2** − Perform steps 3-9, if the activations of the network is not consolidated.

**Step 3** − For each input vector **X**, perform steps 4-8.

**Step 4** − Make initial activation of the network equal to the external input vector **X** as follows −

**Step 5** − For each unit **Y _{i}**, perform steps 6-9.

**Step 6** − Calculate the net input of the network as follows −

**Step 7** − Apply the activation as follows over the net input to calculate the output −

Here θi

is the threshold.

**Step 8** − Broadcast this output **y _{i}** to all other units.

**Step 9** − Test the network for conjunction.

### Energy Function Evaluation

An energy function is defined as a function that is bonded and non-increasing function of the state of the system.

Energy function **E _{f}**, also called

**Lyapunov function**determines the stability of discrete Hopfield network, and is characterized as follows −

**Condition** − In a stable network, whenever the state of node changes, the above energy function will decrease.

Suppose when node **i** has changed state from y(k)i

to y(k+1)i then the Energy change ΔEf

is given by the following relation

Here Δyi=y(k+1)i−y(k)i

The change in energy depends on the fact that only one unit can update its activation at a time.

## Continuous Hopfield Network

In comparison with Discrete Hopfield network, continuous network has time as a continuous variable. It is also used in auto association and optimization problems such as travelling salesman problem.

**Model** − The model or architecture can be build up by adding electrical components such as amplifiers which can map the input voltage to the output voltage over a sigmoid activation function.

### Energy Function Evaluation

Here **λ** is gain parameter and **g _{ri}** input conductance.