04 Associative Memory
04 Associative Memory
Associative Memory
Soft Computing
Soft Computing
Topics
(Lectures 21, 22, 23, 24 4 hours) Slides
1. Associative Memory (AM) Description 03-12
Content addressability; Working of AM; AM Classes : auto and hetero;
AM related terms - encoding or memorization, retrieval or recollection,
errors and noise; Performance measure - memory capacity and
content-addressability.
5. References 42
02
What is Associative Memory ?
from the input pattern not only in content but possibly also in type
and format.
04
1.1 Description of Associative Memory
Blaise Pascal
Marco Polo
Neil Armstrong
Sigmund Freud
Auto-associative memory
Consider, y[1], y[2], y[3], . . . . . y[M], be the number of stored
pattern vectors and let y(m) be the components of these vectors,
representing features extracted from the patterns. The auto-associative
memory will output a pattern vector y(m) when inputting a noisy or
incomplete version of y(m).
Hetero-associative memory
Here the memory function is more general. Consider, we have a
number of key-response pairs {c(1), y(1)}, {c(2), y(2)}, . . . . . . ,
{c(M), y(M)}. The hetero-associative memory will output a pattern
vector y(m) if a noisy or incomplete verson of the c(m) is given.
Example
7
by the symbol
auto-associative and
hetero-associative memory.
Examples
08
1.4 Related Terms
Encoding or memorization
Building an associative memory means, constructing a connection
weight matrix W such that when an input pattern is presented, and
the stored pattern associated with the input pattern is retrieved.
p Wk where
W=
k=1
+1 if input j j
Y j=
-1 other wise
10
Errors and noise
The input pattern may contain errors and noise, or may be an
incomplete version of some previously encoded pattern.
11
Performance Measures
The memory capacity and content-addressability are the measures
of associative memory performance for correct retrieval. These two
performance measures are related to each other.
12
SC - AM models
2. Associative Memory Models
13
2.1 Associative Memory Models
The simplest and among the first studied associative memory models
is Linear associator. It is a feed-forward type of network where the
output is produced in a single feed-forward computation. It can be
used as an auto-associator as well as a hetero-associator, but it
possesses a very low memory capacity and therefore not much used.
15
Linear Associator Model (two layers)
neurons
weights wij
x1 w11 y1
w12 w21
w22
y2
x2
w2m outputs
inputs w1m
wn1
wn2
Ym
Xn
wnm
all n input units are connected to all m output units via connection
Note: The output units behave like linear threshold units; that
compute a weighted sum of the input and produces a -1 or +1
depending whether the weighted sum is below or above a certain
threshold value.
W24 W34
1
W14
W13 W23 W43
W12 W32 W42
W21 W31
W41
4 2
connection
1 2 3 4 neurons
weights I1
wij I2 I3 I4
inputs I 3
V1 V2 V3 V4
outputs V
for i, j = 1, 2, . . . . . , m.
each unit has an external input I which leads to a modification
in the computation of the net input to the units as
m
input j = xi w i j + I j for j = 1, 2, . . ., m.
i=1
th
and xi is the i component of pattern Xk
each unit acts as both input and output unit. Like linear associator,
a single associated pattern pair is stored by computing the weight
T
matrix as Wk = X k Yk where XK = YK
[Continued in next slide]
18
[Continued from previous slide]
neurons neurons
weights wij
x1 w11
y1
w21
w12
y2
w22
x2
outputs
w2m
inputs
wn1 w1m
wn2
Xn wnm
Ym
20
SC - AM auto correlator
3. Auto-associative Memory (auto-correlators)
In the previous section, the structure of the Hopfield model has been
explained. It is an auto-associative memory model which means patterns,
rather than associated pattern pairs, are stored in memory. In this
section, the working of an auto-associative memory (auto-correlator) is
illustrated using some examples.
Working of an auto-correlator :
21
How to Store Patterns : Example
Consider the three bipolar patterns A1 , A2, A3 to be stored as
an auto-correlator.
A1 = (-1, 1 , -1 , 1 )
A2 = ( 1, 1 , 1 , -1 )
A3 = (-1, -1 , -1 , 1 )
patterns are
j
T 1 -1 1 -1
-1 1 -1 1
[A1 ] 4x1 [A1 ] 1x4 =
1 -1 1 -1
-1 1 -1 1
i
T 1 1 1 -1
1 1 1 -1
[A2 ] 4x1 [A2 ] 1x4 =
1 1 1 -1
-1 -1 -1 1
i
T
1 1 1 -1
1 1 1 -1
[A3 ] 4x1 [A3 ] 1x4 =
1 1 1 -1
-1 -1 -1 1
i
i= 1 2 3 4
= ai t i , j=1 1x3 + 1x1 + 1x3 + -1x-3 = 10 1
= ai t i , j=2 1x1 + 1x3 + 1x1 + -1x-1 = 6 1
= ai t i , j=3 1x3 + 1x1 + 1x3 + -1x-3 = 10 1
= ai t i , j=4 1x-3 + 1x-1 + 1x-3 + -1x3 = -1 -1
( a1 , a , a3 , a 4 , ) = ( -1, -1 , -1 , 1 ) = A3
2
23
Recognition of Noisy Patterns (ref. previous slide)
The HDs of A' from each of the stored patterns A1 , A2, A3 are
i= 1 2 3 4
= ai t i , j=1 1x3 + 1x1 + 1x3 + 1x-3 = 4 1
= ai t i , j=2 1x1 + 1x3 + 1x1 + 1x-1 = 4 1
= ai t i , j=3 1x3 + 1x1 + 1x3 + 1x-3 = 4 1
= ai t i , j=4 1x-3 + 1x-1 + 1x-3 + 1x3 = -4 -1
new
= (4 , 1)
a2
new
= (4 , 1)
a3
new
a4 = (-4 , -1)
Definition : If the associated pattern pairs (X, Y) are different and if the
model recalls a pattern Y given a pattern X or vice-versa, then it is
termed as hetero-associative memory.
25
4.1 Bidirectional Associative Memory (BAM) Operations
Denote one layer as field A with elements Ai and the other layer
as field B with elements Bi.
N
the original correlation matrix of the BAM is M0 = T
[ Xi ] [ Yi ]
i=
1
where Xi = (xi1 , xi2 , . . . , xin) and Yi = (yi1 , yi2 , . . . , yip)
26
Retrieve the Nearest of a Pattern Pair, given any pair
(ref : previous slide)
Example
Retrieve the nearest of (Ai , Bi) pattern pair, given any pair ( , ) .
gi = , fi < 0
-1 (bipolar)
previous g i , fi = 0
Kosko has proved that this process will converge for any
correlation matrix M.
27
Addition and Deletion of Pattern Pairs
Given a set of pattern pairs (Xi , Yi) , for i = 1 , 2, . . . , n and a set
of correlation matrix M :
a new pair (X' , Y') can be added or
an existing pair (Xj , Yj) can be deleted from the memory model.
T T T T
Mnew = X1 Y1 + X1 Y1 + . . . . + Xn Yn + X' Y'
from the correlation matrix M , them the new correlation matrix Mnew
is given by
T
Mnew = M - ( Xj Yj )
28
4.2 Energy Function for BAM
Note : A system that changes with time is a dynamic system. There are two
types of dynamics in a neural network. During training phase it iteratively update
weights and during production phase it asymptotically converges to the solution
patterns. State is a collection of qualitative and qualitative items that characterize
the system e.g., weights, data flows. The Energy function (or Lyapunov function)
is a bounded function of the system state that decreases with time and the
system solution is the minimum energy.
Let a pair (A , B) defines the state of a BAM.
to store a pattern, the value of the energy function for that pattern
E(A, B) = - T
AM B ; for a particular case A = B , it corresponds
We wish to retrieve the nearest of (Ai , Bi) pair, when any ( , ) pair
is presented as initial condition to BAM. The neurons change
their states until a bidirectional stable state (Af , Bf) is reached. Kosko
has shown that such stable state is reached for any matrix M when it
corresponds to local minimum of the energy function. Each cycle of
decoding lowers the energy E if the energy function for any point
T
( , ) is given E = M
by T
If the energy E = Ai M Bi evaluated using coordinates of the pair
(Ai , Bi) does not constitute a local minimum, then the point cannot
be recalled, even though one starts with = Ai. Thus Kosko's encoding
method does not ensure that the stored pairs are at a local minimum.
29
Example : Kosko's BAM for Retrieval of Associated Pair
The working of Kosko's BAM for retrieval of associated pair.
Start with X3, and hope to retrieve the associated pair Y3 .
A1 = ( 1 0 0 0 0 1 ) B1 = ( 1 1 0 0 0 )
A2 = ( 0 1 1 0 0 0 ) B2 = ( 1 0 1 0 0 )
A3 = ( 0 0 1 0 1 1 ) B3 = ( 0 1 1 1 0 )
X1 = ( 1 -1 -1 -1 -1 1 ) Y1 = ( 1 1 -1 -1 -1 )
X2 = ( -1 1 1 -1 -1 -1 ) Y2 = ( 1 -1 1 -1 -1 )
X3 = ( -1 -1 1 -1 1 1 ) Y3 = ( -1 1 1 1 -1 )
Y1 + T
T -1 -1 3 1 -1
+ X3 Y3 =
T X2 Y2 -1 -1 -1 1 3
M = X1
-3 1 1 3 1
-1 3 -1 1 -1
Suppose we start with = X3, and we hope to retrieve the associated pair
M = ( -1 -1 1 -1 1 1 ) ( M ) = ( -6 6 6 6 -6 )
( M) = ' = ( -1 1 1 1 -1 )
T
' M = ( -5 -5 5 -3 7 5 )
T
(' M ) = ( -1 -1 1 -1 1 1 ) = '
' M = ( -1 -1 1 -1 1 1 ) M = ( -6 6 6 6 -6 )
(' M) = " = ( -1 1 1 1 1 -1 )
= '
A1 = ( 1 0 0 1 1 1 0 0 0 ) B1 = ( 1 1 1 0 0 0 0 1 0 )
A2 = ( 0 1 1 1 0 0 1 1 1 ) B2 = ( 1 0 0 0 0 0 0 0 1 )
A3 = ( 1 0 1 0 1 1 0 1 1 ) B3 = ( 0 1 0 1 0 0 1 0 1 )
X1 = ( 1 -1 -1 1 1 1 -1 -1 -1 ) Y1 = ( 1 1 1 -1 -1 -1 -1 1 -1 )
X2 = ( -1 1 1 1 -1 -1 1 11 ) Y2 = ( 1 -1 -1 -1 -1 -1 -1 -1 1 )
X3 = ( 1 -1 1 -1 1 1 -1 1 1 ) Y3 = ( -1 1 -1 1 -1 -1 1 0 1 )
-1 3 1 1 -1 -1 1 1 -1
1 -3 -1 -1 1 1 -1 -1 1
-1 -1 -3 1 -1 -1 1 -3 3
3 -1 1 -3 -1 -1 -3 1 -1
= -1 3 1 1 -1 -1 1 1 -1
-1 3 1 1 -1 -1 1 1 -1
1 -3 -1 -1 1 1 -1 -1 1
-1 -1 -3 1 -1 -1 1 -3 3
-1 -1 -3 1 -1 -1 1 -3 3
31
SC - Bidirectional hetero AM
[Continued from previous
slide]
Let the pair (X2 , Y2 ) be recalled.
X2 = ( -1 1 1 1 -1 -1 1 11 ) Y2 = ( 1 -1 -1 -1 -1 -1 -1 -1 1 )
( M) = ( 1 -1 -1 -1 1 1 -1 -1 1 ) = '
' MT = ( -11 11 5 5 -11 -11 11 5 5 )
(' = ( -1 1 1 1 -1 -1 1 1 1 ) = '
T
MM
' ) = ( 5 -19 -13 -5 1 1 -5 -13 13 )
(' M) = ( 1 -1 -1 -1 1 1 -1 -1 1 ) = "
= '
F = ' = ( -1 1 1 1 -1 -1 1 1 1 ) = X2
F = ' = ( 1 -1 -1 -1 1 1 -1 -1 1 ) Y2
But ' is not Y2 . Thus the vector pair (X2 , Y2) is not recalled
correctly by Kosko's decoding process.
32
Check with Energy Function : Compute the energy functions
T
= -71
for the coordinates of pair (X2 , Y2) , the energy E2 = - X2 M Y2
Y2 ' = ( 1 -1 -1 -1 1 -1 -1 -1 1 )
33
SC - Bidirectional hetero AM
4.3 Multiple Training Encoding Strategy
retrieve the nearest pair given any pair ( , ), with the help of recall
equations. However, Kosko's encoding method does not ensure that the stored
pairs are at local minimum and hence, results in incorrect recall.
The new value of the energy function E evaluated at (Ai , Bi) then becomes
T XTi Yi Bi T
E' (Ai , Bi) = Ai M Bi (q 1) Ai
X1 = ( 1 -1 -1 1 1 1 -1 -1 -1 ) Y1 = ( 1 1 1 -1 -1 -1 -1 1 -1 )
X2 = ( -1 1 1 1 -1 -1 1 11 ) Y2 = ( 1 -1 -1 -1 -1 -1 -1 -1 1 )
X3 = ( 1 -1 1 -1 1 1 -1 1 1 ) Y3 = ( -1 1 -1 1 -1 -1 1 0 1 )
X2 = ( -1 1 1 1 -1 -1 1 11 ) Y2 = ( 1 -1 -1 -1 -1 -1 -1 -1 1 )
T
the augmented correlation matrix M
T
Choose q=2, so that P = X2 Y2 ,
T T
becomes M = X1 Y1 + 2 X2 Y2 + X 3 Y3
4 2 2 0 0 2 2 -2
2 -4 -2 -2 0 0 -2 -2 2
0 -2 -4 0 -2 -2 0 -4 4
= 4 -2 0 -4 -2 -2 -4 0 0
-2 4 2 2 0 0 2 2 -2
-2 4 2 2 0 0 2 2 -2
2 -4 -2 -2 0 0 -2 -2 2
0 -2 -4 0 -2 -2 0 -4 4
0 -2 -4 0 -2 -2 0 -4 4
35
SC - Bidirectional hetero AM
[Continued from previous slide]
Now give = X2, and see that the corresponding pattern pair = Y2
( M) = ( 1 -1 -1 -1 -1 -1 -1 -1 1 ) = '
T
' M = ( -16 16 18 18 -16 -16 16 18 18 )
(' M) = ( 1 -1 -1 -1 1 1 -1 -1 1 ) = "
F = ' = ( -1 1 1 1 -1 -1 1 1 1 ) = X2
F = ' = ( 1 -1 -1 -1 1 1 -1 -1 1 ) = Y2
36
Note : The previous slide showed that the pattern pair (X2 , Y2 ) is correctly
recalled, using augmented correlation matrix
T
T T
M = X 1 Y1 X3 Y3
+ 2 X2 Y2 +
but then the same matrix M can not recall correctly the other
pattern pair (X1 , Y1 ) as shown below.
X1 = ( 1 -1 -1 1 1 1 -1 -1 -1 ) Y1 = ( 1 1 1 -1 -1 -1 -1 1 -1 )
M = ( -6 24 22 6 4 4 6 22 -22 )
( M) = ( -1 1 1 1 1 1 1 1 -1 ) = '
T
' M = ( 16 -16 -18 -18 16 16 -16 -18 -18 )
T
(' M ) = ( 1 -1 -1 -1 1 1 -1 -1 -1 ) = '
' M = ( -14 28 22 14 8 8 14 22 -22 )
(' M) = ( -1 1 1 1 1 1 1 1 -1 ) = "
F = ' = ( 1 -1 -1 -1 1 1 -1 -1 -1 ) = X1
F = ' = ( -1 1 1 1 1 1 1 1 -1 ) Y1
Thus, the pattern pair (X1 , Y1 ) is not correctly recalled, using augmented
correlation matrix M.
-1 5 3 1 -1 -1 1 3 -3
1 -5 -3 -1 1 1 -1 -3 3
-1 -3 -5 1 -1 -1 1 -5 5
5 -1 1 -5 -3 -3 -5 1 -1
= -1 5 3 1 -1 -1 1 3 -3
-1 5 3 1 -1 -1 1 3 -3
1 -5 -3 -1 1 1 -1 -3 3
-1 -3 -5 1 -1 -1 1 -5 5
-1 -3 -5 1 -1 -1 1 -5 5
Now observe in the next slide that all three pairs can be correctly recalled.
38
Recall of pattern pair (X1 , Y1 )
X1 = ( 1 -1 -1 1 1 1 -1 -1 -1 ) Y1 = ( 1 1 1 -1 -1 -1 -1 1 -1 )
-3 31 -31 M = ( 3 33 31 -3 -5 -5 )
-1 ( M) = ( 1 1 1 -1 -1 -1 1 -1 ) = '
(' M T ) = ( 13 -13 -19 23 13 13 -13 -19 -19 )
(' M T ) = ( 1 -1 -1 1 1 1 -1 -1 -1 ) = '
' M = ( 3 33 31 -3 -5 -5 -3 31 -31 )
(' M) = ( 1 1 1 -1 -1 -1 -1 1 -1 ) = "
F = ' = ( 1 -1 -1 1 1 1 -1 -1 -1 ) = X1
F = ' = ( 1 1 1 -1 -1 -1 -1 1 -1 ) = Y1
F = ' = ( -1 1 1 1 -1 -1 1 1 1 ) = X2
F = ' = ( 1 -1 -1
-1 -1 -1 -1 -1 1 ) = Y2
M = ( -13 17 -1 13 -5 -5 13 -1 1 )
( M) = ( -1 1 -1 1 -1 -1 1 -1 1 ) = '
(' M T ) = ( 11 -11 27 -63 11 11 -11 27 27 )
(' M T ) = ( 1 -1 1 -1 1 1 -1 1 1 ) = '
' M = ( -13 17 -1 13 -5 -5 13 -1 1 )
(' M) = ( -1 1 -1 1 -1 -1 1 -1 1 ) = "
F = ' = ( 1 -1 1 -1 1 1 -1 1 1 ) = X3
F = ' = ( -1 1 -1 1 -1 -1 1 0 1 ) = Y3
40
SC - Bidirectional hetero AM
Algorithm (for the Multiple training encoding strategy)
Yi
Y2 YN (
= (xj 1 ,xj 2
..
.
,
wh
er
e
Y
SC - Bidirectional hetero AM
,...xj n ) = , )
q : is the weight vector (q1 , q2 , . . . . , qN )
For i 1 to N
M M [ qi Transpose Xi ) ( Xi ) end
(
end
41
SC AM References
5. References : Textbooks
42