iii. recurrent neural networks -...

87
2/24/19 1 III. Recurrent Neural Networks

Upload: others

Post on 22-Mar-2020

17 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 1

III. Recurrent Neural Networks

Page 2: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 2

A.The Hopfield Network

Page 3: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 3

Typical Artificial Neuron

inputs

connectionweights

threshold

output

Page 4: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 4

Typical Artificial Neuron

linearcombination

net input(local field)

activationfunction

Page 5: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 5

Equations

hi = wijs jj=1

n

∑#

$ % %

&

' ( ( −θ

h =Ws−θ

Net input:

" s i =σ hi( )" s =σ h( )

New neural state:

Page 6: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 6

Hopfield Network• Symmetric weights: wij = wji

• No self-action: wii = 0• Zero threshold: ! = 0• Bipolar states: si ∈ {–1, +1}• Discontinuous bipolar activation function:

σ h( ) = sgn h( ) =−1, h < 0+1, h > 0$ % &

Page 7: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 7

What to do about h = 0?• There are several options:

§ σ(0) = +1§ σ(0) = –1§ σ(0) = –1 or +1 with equal probability§ hi = 0 ⇒ no state change (si′= si)

• Not much difference, but be consistent• Last option is slightly preferable, since

symmetric and deterministic

Page 8: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 8

Positive Coupling

• Positive sense (sign)• Large strength

Page 9: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 9

Negative Coupling

• Negative sense (sign)• Large strength

Page 10: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 10

Weak Coupling• Either sense (sign)• Little strength

Page 11: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 11

State = –1 & Local Field < 0

h < 0

Page 12: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 12

State = –1 & Local Field > 0

h > 0

Page 13: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 13

State Reverses

h > 0

Page 14: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 14

State = +1 & Local Field > 0

h > 0

Page 15: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 15

State = +1 & Local Field < 0

h < 0

Page 16: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 16

State Reverses

h < 0

Page 17: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 17

NetLogo Demonstration of Hopfield State Updating

Run Hopfield-update.nlogo

Page 18: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 18

Hopfield Net as Soft Constraint Satisfaction System

• States of neurons as yes/no decisions• Weights represent soft constraints between

decisions– hard constraints must be respected– soft constraints have degrees of importance

• Decisions change to better respect constraints

• Is there an optimal set of decisions that best respects all constraints?

Page 19: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 19

Demonstration of Hopfield Net Dynamics I

Run Hopfield-dynamics.nlogo

Page 20: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 20

Convergence

• Does such a system converge to a stable state?

• Under what conditions does it converge?• There is a sense in which each step relaxes

the “tension” in the system• But could a relaxation of one neuron lead to

greater tension in other places?

Page 21: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 21

Quantifying “Tension”• If wij > 0, then si and sj want to have the same sign

(si sj = +1)• If wij < 0, then si and sj want to have opposite signs

(si sj = –1)• If wij = 0, their signs are independent• Strength of interaction varies with |wij|• Define “tension” Tij between neurons i and j:

Tij = – si wij sjTij < 0 ⇒ they are happyTij > 0 ⇒ they are unhappy

Page 22: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 22

Total Energy of SystemThe “energy” of the system is the total

“tension” in it:

! " = ∑ %& '%&= −∑ %& )%*%&)&= −+

, ∑- ∑./- 0-1-.0.= −+

, ∑- ∑. 0-1-.0., if 2%& = 0= −+

,"45"

Page 23: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 23

Review of Some Vector Notation

x =

x1xn

"

#

$ $ $

%

&

' ' '

= x1 xn( )T (column vectors)

xTy = xiyi = x ⋅ yi=1

n∑ (inner product)

xyT =

x1y1 x1yn

xmy1 xmyn

"

#

$ $ $

%

&

' ' '

(outer product)

xTMy = xiMij y jj=1

n∑i=1

m∑ (quadratic form)

Page 24: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 24

Another View of EnergyThe energy measures the disharmony of the

neurons’ states with their local fields (i.e. of opposite sign):

E s{ } = − 12 siwijs j

j∑

i∑

= − 12 si wijs j

j∑

i∑

= − 12 sihi

i∑

= − 12 s

Th

Page 25: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 25

Do State Changes Decrease Energy?• Suppose that neuron k changes state• Change of energy:

ΔE = E # s { }− E s{ }

= − # s iwij # s j + siwijs jij∑

ij∑

= − # s kwkjj≠k∑ s j + skwkjs j

j≠k∑

= − # s k − sk( ) wkjs jj≠k∑

= −Δskhk

< 0

Page 26: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 26

Energy Does Not Increase

• In each step in which a neuron is considered for update:E{s(t + 1)} – E{s(t)} ≤ 0

• Energy cannot increase• Energy decreases if any neuron changes• Must it stop?

Page 27: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 27

Proof of Convergencein Finite Time

• There is a minimum possible energy:– The number of possible states s∈ {–1, +1}n is

finite– Hence Emin = min {E(s) | s ∈ {�1}n} exists

• Must reach in a finite number of steps because only finite number of states

Page 28: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 28

Conclusion

• If we do asynchronous updating, the Hopfield net must reach a stable, minimum energy state in a finite number of updates

• This does not imply that it is a global minimum

Page 29: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 29

Lyapunov Functions• A way of showing the convergence of

discrete- or continuous-time dynamical systems

• For discrete-time system:§ need a Lyapunov function E (“energy” of the state)§ E is bounded below (E{s} > Emin)§ ∆E < (∆E)max ≤ 0 (energy decreases a certain

minimum amount each step)§ then the system will converge in finite time

• Problem: finding a suitable Lyapunov function

Page 30: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 30

Example Limit Cycle with Synchronous Updating

w > 0 w > 0

Page 31: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 31

The Hopfield Energy Function is Even

• A function f is odd if f (–x) = – f (x),for all x

• A function f is even if f (–x) = f (x),for all x

• Observe:

E −s{ } = − 12 (−s)TW(−s) = − 1

2 sTWs = E s{ }

Page 32: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 32

Conceptual Picture of

Descent on Energy Surface

(fig. from Solé & Goodwin)

Page 33: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 33

Energy Surface

(fig. from Haykin Neur. Netw.)

Page 34: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 34

Energy Surface

+Flow Lines

(fig. from Haykin Neur. Netw.)

Page 35: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 35

Flow Lines

(fig. from Haykin Neur. Netw.)

Basins ofAttraction

Page 36: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 36

Bipolar State Space

Page 37: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 37

Basins in

Bipolar State Space

energy decreasing paths

Page 38: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 38

Demonstration of Hopfield Net Dynamics II

Run initialized Hopfield.nlogo

Page 39: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 39

Storing Memories as

Attractors

(fig. from Solé & Goodwin)

Page 40: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 40

Example of Pattern

Restoration

(fig. from Arbib 1995)

Page 41: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 41

Example of Pattern

Restoration

(fig. from Arbib 1995)

Page 42: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 42

Example of Pattern

Restoration

(fig. from Arbib 1995)

Page 43: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 43

Example of Pattern

Restoration

(fig. from Arbib 1995)

Page 44: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 44

Example of Pattern

Restoration

(fig. from Arbib 1995)

Page 45: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 45

Example of Pattern

Completion

(fig. from Arbib 1995)

Page 46: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 46

Example of Pattern

Completion

(fig. from Arbib 1995)

Page 47: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 47

Example of Pattern

Completion

(fig. from Arbib 1995)

Page 48: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 48

Example of Pattern

Completion

(fig. from Arbib 1995)

Page 49: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 49

Example of Pattern

Completion

(fig. from Arbib 1995)

Page 50: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 50

Example of Association

(fig. from Arbib 1995)

Page 51: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 51

Example of Association

(fig. from Arbib 1995)

Page 52: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 52

Example of Association

(fig. from Arbib 1995)

Page 53: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 53

Example of Association

(fig. from Arbib 1995)

Page 54: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 54

Example of Association

(fig. from Arbib 1995)

Page 55: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 55

Applications ofHopfield Memory

• Pattern restoration• Pattern completion• Pattern generalization• Pattern association

Page 56: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 56

Hopfield Net for Optimization and for Associative Memory

• For optimization:– we know the weights (couplings)– we want to know the minima (solutions)

• For associative memory:– we know the minima (retrieval states)– we want to know the weights

Page 57: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 57

Hebb’s Rule

“When an axon of cell A is near enough to excite a cell B and repeatedly or persistently takes part in firing it, some growth or metabolic change takes place in one or both cells such that A’s efficiency, as one of the cells firing B, is increased.”

—Donald Hebb (The Organization of Behavior, 1949, p. 62)

“Neurons that fire together, wire together”

Page 58: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 58

Example of Hebbian Learning:Pattern Imprinted

Page 59: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 59

Example of Hebbian Learning:Partial Pattern Reconstruction

Page 60: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 60

Mathematical Model of Hebbian Learning for One Pattern

Let Wij =xix j , if i ≠ j

0, if i = j# $ %

Since xixi = xi2 =1,

W = xxT − I

For simplicity, we will include self-coupling:

W = xxT

Page 61: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 61

A Single Imprinted Pattern is a Stable State

• Suppose W = xxT

• Then h = Wx = xxTx = nxsince

• Hence, if initial state is s = x, then new state is s′= sgn (n x) = x

• For this reason, scale W by 1/n• May be other stable states (e.g., –x)€

xTx = xi2 = ±1( )2

i=1

n∑ = n

i=1

n∑

Page 62: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 62

Questions

• How big is the basin of attraction of the imprinted pattern?

• How many patterns can be imprinted?• Are there unneeded spurious stable states?• These issues will be addressed in the

context of multiple imprinted patterns

Page 63: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 63

Imprinting Multiple Patterns

• Let x1, x2, …, xp be patterns to be imprinted• Define the sum-of-outer-products matrix:

Wij = 1n xi

k x jk

k=1

p

W = 1n x k x k( )

T

k=1

p

Page 64: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 64

Definition of CovarianceConsider samples (x1, y1), (x2, y2), …, (xN, yN)

Let x = xk and y = yk

Covariance of x and y values :

= xk yk − x yk − xk y + x ⋅ y

= xk yk − x yk − xk y + x ⋅ y

= xk yk − x ⋅ y − x ⋅ y + x ⋅ y

Cxy = xk yk − x ⋅ y

Cxy = xk − x ( ) yk − y ( )

Page 65: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 65

Weights & the Covariance MatrixSample pattern vectors: x1, x2, …, xp

Covariance of ith and jth components:

Cij = xik x j

k − xi ⋅ x j

If ∀i : xi = 0 (±1 equally likely in all positions) :

Cij = xik x j

k

= 1p xi

k x jk

k=1

p∑

∴nW = pC

Page 66: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 66

Characteristicsof Hopfield Memory

• Distributed (“holographic”)– every pattern is stored in every location

(weight)• Robust

– correct retrieval in spite of noise or error in patterns

– correct operation in spite of considerable weight damage or noise

Page 67: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 67

Demonstration of Hopfield Net

Run Malasri Hopfield Demo

Page 68: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 68

Stability of Imprinted Memories• Suppose the state is one of the imprinted

patterns xm

• Then:

h =Wxm = 1n x k x k( )

T

k∑[ ]xm= 1

n x k x k( )T xmk∑= 1

n xm xm( )T xm + 1

n x k x k( )T xmk≠m∑

= xm + 1n x k ⋅ xm( )x kk≠m∑

Page 69: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 69

Interpretation of Inner Products• xk ∙ xm = n if they are identical

– highly correlated• xk ∙ xm = –n if they are complementary

– highly correlated (reversed)• xk ∙ xm = 0 if they are orthogonal

– largely uncorrelated• xk ∙ xm measures the crosstalk between

patterns k and m

Page 70: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 70

Cosines and Inner products

u ⋅ v = u v cosθuv

If u is bipolar, then u 2= u ⋅u = n

Hence, u ⋅ v = n n cosθuv = ncosθuv

u

v

θuv

Hence h = xm + x k cosθkmk≠m∑

Page 71: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 71

Conditions for Stability

Stability of entire pattern :

xm = sgn xm + x k cosθkmk≠m∑

%

& '

(

) *

Stability of a single bit :

xim = sgn xi

m + xik cosθkm

k≠m∑

%

& '

(

) *

Page 72: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 72

Sufficient Conditions for Instability (Case 1)

Suppose xim = −1. Then unstable if :

−1( ) + xik cosθkm > 0

k≠m∑

xik cosθkm >1

k≠m∑

Page 73: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 73

Sufficient Conditions for Instability (Case 2)

Suppose xim = +1. Then unstable if :

+1( ) + xik cosθkm < 0

k≠m∑

xik cosθkm < −1

k≠m∑

Page 74: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 74

Sufficient Conditions for Stability

xik cosθkm

k≠m∑ ≤1

The crosstalk with the sought pattern must be sufficiently small

Page 75: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 75

Capacity of Hopfield Memory

• Depends on the patterns imprinted• If orthogonal, pmax = n

– weight matrix is identity matrix– hence every state is stable ⇒ trivial basins

• So pmax < n• Let load parameter α = p / n

equations

Page 76: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 76

Single Bit Stability Analysis• For simplicity, suppose xk are random• Then xk ∙ xm are sums of n random �1

§ binomial distribution ≈ Gaussian§ in range –n, …, +n§ with mean μ = 0§ and variance σ2 = n

• Probability sum > t:

[See “Review of Gaussian (Normal) Distributions” on course website]

12 1− erf

t2n

#

$ %

&

' (

)

* +

,

- .

Page 77: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 77

Approximation of Probability

Let crosstalk Cim = 1

n xik x k ⋅ xm( )

k≠m∑

We want Pr Cim >1{ } = Pr nCi

m > n{ }

Note : nCim = xi

k x jk x j

m

j=1

n

∑k=1k≠m

p

A sum of n(p −1) ≈ np random ±1s

Variance σ 2 = np

Page 78: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 78

Probability of Bit Instability

Pr nCim > n{ } = 1

2 1− erfn2np

#

$ %

&

' (

)

* + +

,

- . .

= 12 1− erf n 2p( )[ ]

= 12 1− erf 1 2α( )[ ]

(fig. from Hertz & al. Intr. Theory Neur. Comp.)

Page 79: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 79

Tabulated Probability ofSingle-Bit Instability

Perror α0.1% 0.105

0.36% 0.138

1% 0.185

5% 0.37

10% 0.61

(table from Hertz & al. Intr. Theory Neur. Comp.)

Page 80: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

Orthogonality of Random Bipolar Vectors of High Dimension

• 99.99% probability of being within 4σ of mean (= 0)

• It is 99.99% probable that random n-dimensional vectors will be within ε = 4/√n orthogonal

• ε = 4% for n = 10,000• Probability of being less

orthogonal than any ε decreases exponentially with n

• The brain gets approximate orthogonality by assigning random high-dimensional vectors

2/24/19 80

u ⋅v < 4σ

iff u v cosθ < 4 n

iff n cosθ < 4 n

iff cosθ < 4 / n = ε

Pr cosθ > ε{ }= erfc ε n2

!

"#

$

%&

≈16exp −ε 2n / 2( )+ 12 exp −2ε 2n / 3( )

Page 81: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 81

Spurious Attractors• Mixture states:

– sums or differences of odd numbers of retrieval states– number increases combinatorially with p– shallower, smaller basins– basins of mixtures swamp basins of retrieval states ⇒

overload– useful as combinatorial generalizations?– self-coupling generates spurious attractors

• Spin-glass states:– not correlated with any finite number of imprinted

patterns– occur beyond overload because weights effectively

random

Page 82: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 82

Basins of Mixture States

xmix

x k2€

x k1

x k3

ximix = sgn xi

k1 + xik2 + xi

k3( )

Page 83: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

Run Hopfield-Capacity Test

2/24/19 83

Page 84: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 84

Fraction of Unstable Imprints(n = 100)

(fig from Bar-Yam)

Page 85: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 85

Number of Stable Imprints(n = 100)

(fig from Bar-Yam)

Page 86: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 86

Number of Imprints with Basins of Indicated Size (n = 100)

(fig from Bar-Yam)

Page 87: III. Recurrent Neural Networks - UTKweb.eecs.utk.edu/~bmaclenn/Classes/420-527/handouts/Part-3A.pdf · Recurrent Neural Networks. 2/24/19 2 A. The Hopfield Network. 2/24/19 3 Typical

2/24/19 87

Summary of Capacity Results• Absolute limit: pmax < αcn = 0.138 n• If a small number of errors in each pattern

permitted: pmax ∝ n• If all or most patterns must be recalled

perfectly: pmax ∝ n / log n• Recall: all this analysis is based on random

patterns• Unrealistic, but sometimes can be arranged

III B