pattern association a pattern association learns associations between input patterns and output...

40
Pattern Association A pattern association learns associations between input patterns and output patterns. One of the most appealing characteristics of such a network is the fact that it can generate what it learns about one pattern to other similar input patterns. Pattern associations have been widely used in distributed memory modeling.

Post on 19-Dec-2015

221 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Pattern Association  A pattern association learns associations between input patterns and output patterns.  One of the most appealing characteristics

Pattern Association A pattern association learns associations

between input patterns and output patterns. One of the most appealing characteristics of

such a network is the fact that it can generate what it learns about one pattern to other similar input patterns.

Pattern associations have been widely used in distributed memory modeling.

Page 2: Pattern Association  A pattern association learns associations between input patterns and output patterns.  One of the most appealing characteristics

Pattern Association The pattern association is one of the more basic two-

layer networks. Its architecture consists of two sets of units, the input

units and the output units. Each input unit connects to each output unit via weighted

connections. Connections are only allowed from input units to output

units. The effect of a unit ui in the input layer on a unit uj in the

output layer is determined by the product of the activation ai of ui and the weight of the connection from ui

to uj. The activation of a unit uj in the output layer is given by: SUM(wij * ai).

Page 3: Pattern Association  A pattern association learns associations between input patterns and output patterns.  One of the most appealing characteristics

Pattern Association

A pattern association can be trained to respond with a certain output pattern when presented with an input pattern.

The connection weights can be adjusted in order to change the input/output behavior.

However, one of the most interesting properties of these models is their ability to self-modify and learn.

The learning rule is what specifies how a network changes it weights for a given input/output association.

The most commonly used learning rules with pattern associators are the Hebb rule and the Delta rule.

Page 4: Pattern Association  A pattern association learns associations between input patterns and output patterns.  One of the most appealing characteristics

Each association is an input-output vector pair, s:t.

If each vector t is the same as the vector s with which it is associated, the net called auto-associative memory

If t’s are different from the s, the net is called hetero-associative memory

Page 5: Pattern Association  A pattern association learns associations between input patterns and output patterns.  One of the most appealing characteristics

Training Algorithms For Pattern Association Hebb Rule for Pattern Association

The simplest and most common method of determining the weights for an associative memory NN.

Can use pattern represented in binary or bipolar. Similar algorithm with slight extension where finding

the weights by outer products. We want to consider examples in which the input to

the net after training is a pattern that is similar to, but not the same as one of the training inputs.

Page 6: Pattern Association  A pattern association learns associations between input patterns and output patterns.  One of the most appealing characteristics

Training Algorithms For Pattern Association

Hebb Rule for Pattern AssociationStep 0: Initialize all weights:

wij = 0 (i= 1 … n; j = 1, …,m);

Step 1: For each input training vector pair and target output pair, s:t, do steps 2-4

Step 2. Set activations for input units:

xi = si (i = 1 to n).Step 3. Set activation for output unit:

yj = tj (t= target)Step 4. Adjust the weights for

wi,j(new) = wi,j(old) + xi yj

(i= 1 … n; j = 1, …,m);

Page 7: Pattern Association  A pattern association learns associations between input patterns and output patterns.  One of the most appealing characteristics

Hebb Rule for Pattern Association

Outer products The weights found by using the Hebb rule with all

weights initially 0) can also be described in terms of outer products of the input vector-output vector pairs.

The outer products of two vectors s = (s1, …, si, …, sn)

t = (t1, …, tj, … tm)

Page 8: Pattern Association  A pattern association learns associations between input patterns and output patterns.  One of the most appealing characteristics

Hebb Rule for Pattern Association

The outer products of two vectors s = (s1, …, si, …, sn)

t = (t1, …, tj, … tm)

ST = s1

:

si

:

sn

[t1, .., tj .. tm) =

s1t1 …s1tj … s1tm

:sit1 … sitj … sitm

:snt1 … sntj … sntm

Page 9: Pattern Association  A pattern association learns associations between input patterns and output patterns.  One of the most appealing characteristics

Hebb Rule for Pattern Association

This is the weight matrix to store the association s:t found using Hebb rule

To store a set of associations s(p) : t(p), p= 1, …, P, where s(p) = (si(p), …, si(p), …, sn(p)) and

t(p) = (ti(p), …, ti(p), …, tm(p))

the weight matrix W = {wij} is given by

wij = si(p) ti(p) or in general W = sT(p) t (p) p=1

P

p=1

P

Page 10: Pattern Association  A pattern association learns associations between input patterns and output patterns.  One of the most appealing characteristics

Hebbian learning in a neural networkHebbian learning in a neural network

i j

I n

p u

t S

i g

n a

l s

O u

t p

u t

S i

g n

a l s

Page 11: Pattern Association  A pattern association learns associations between input patterns and output patterns.  One of the most appealing characteristics

Using Hebb’s Law we can express the adjustment Using Hebb’s Law we can express the adjustment applied to the weight applied to the weight wwijij at iteration at iteration pp in the in the

following form:following form:

As a special case, we can represent Hebb’s Law as As a special case, we can represent Hebb’s Law as follows:follows:

where where is the is the learning ratelearning rate parameter. parameter.

This equation is referred to as the This equation is referred to as the activity product activity product rulerule..

][ )( ),()( pxpyFpw ijij

)( )( )( pxpypw ijij

Page 12: Pattern Association  A pattern association learns associations between input patterns and output patterns.  One of the most appealing characteristics

Hebbian learning implies that weights can only Hebbian learning implies that weights can only increase. To resolve this problem, we might increase. To resolve this problem, we might impose a limit on the growth of synaptic weights. impose a limit on the growth of synaptic weights. It can be done by introducing a non-linear It can be done by introducing a non-linear forgetting factorforgetting factor into Hebb’s Law: into Hebb’s Law:

where where is the forgetting factor. is the forgetting factor.

Forgetting factor usually falls in the interval Forgetting factor usually falls in the interval between 0 and 1, typically between 0.01 and 0.1, between 0 and 1, typically between 0.01 and 0.1, to allow only a little “forgetting” while limiting to allow only a little “forgetting” while limiting the weight growth.the weight growth.

)( )( )( )( )( pwpypxpypw ijjijij

Page 13: Pattern Association  A pattern association learns associations between input patterns and output patterns.  One of the most appealing characteristics

Hebbian learning algorithmHebbian learning algorithm

Step 1Step 1: Initialisation.: Initialisation. Set initial synaptic weights and thresholds to small Set initial synaptic weights and thresholds to small random values, say in an interval [0, 1].random values, say in an interval [0, 1].

Step 2Step 2: Activation.: Activation.Compute the neuron output at iteration Compute the neuron output at iteration pp

where where nn is the number of neuron inputs, and is the number of neuron inputs, and jj is the is the

threshold value of neuron threshold value of neuron jj..

j

n

iijij pwpxpy

1

)( )()(

Page 14: Pattern Association  A pattern association learns associations between input patterns and output patterns.  One of the most appealing characteristics

Step 3Step 3:: Learning.Learning. Update the weights in the network:Update the weights in the network:

where where wwijij((pp) is the weight correction at iteration ) is the weight correction at iteration pp..

The weight correction is determined by the The weight correction is determined by the generalised activity product rule:generalised activity product rule:

Step 4Step 4: Iteration.: Iteration. Increase iteration Increase iteration pp by one, go back to Step 2. by one, go back to Step 2.

)()()1( pwpwpw ijijij

][ )()()( )( pwpxpypw ijijij

Page 15: Pattern Association  A pattern association learns associations between input patterns and output patterns.  One of the most appealing characteristics

To illustrate Hebbian learning, consider a fully To illustrate Hebbian learning, consider a fully connected feedforward network with a single layer connected feedforward network with a single layer of five computation neurons. Each neuron is of five computation neurons. Each neuron is represented by a McCulloch and Pitts model with represented by a McCulloch and Pitts model with the sign activation function. The network is trained the sign activation function. The network is trained on the following set of input vectors:on the following set of input vectors:

Hebbian learning eHebbian learning examplexample

Page 16: Pattern Association  A pattern association learns associations between input patterns and output patterns.  One of the most appealing characteristics

Input layer

x1 1

Output layer

2

1 y1

y2x2 2

x3 3

x4 4

x5 5

4

3 y3

y4

5 y5

1

0

0

0

1

1

0

0

0

1

Input layer

x1 1

Output layer

2

1 y1

y2x2 2

x3 3

x4 4

x5

4

3 y3

y4

5 y5

1

0

0

0

1

0

0

1

0

1

2

5

Initial and final states of the networkInitial and final states of the network

Page 17: Pattern Association  A pattern association learns associations between input patterns and output patterns.  One of the most appealing characteristics

I n

p u

t l

a y

e r

O u t p u t l a y e r

1 0 0 1 0

0 1 0 0 0

0 0 1 0 0

1 0 0 1 0

0 0 0 0 0

21 43 5

1

2

3

4

5

O u t p u t l a y e r

I n

p u

t l

a y

e r

0

0

0

0

0

1 2 3 4 5

1

2

3

4

5

0

0

2.0204

0

2.0204

1.0200

0

0

0

0 0.9996

0

0

0

0

0

0

2.0204

0

2.0204

(b).

Initial and final weight matricesInitial and final weight matrices

Page 18: Pattern Association  A pattern association learns associations between input patterns and output patterns.  One of the most appealing characteristics

When this probe is presented to the network, we When this probe is presented to the network, we obtain:obtain:

1

0

0

0

1

X

1

0

0

1

0

0737.0

9478.0

0907.0

2661.0

4940.0

1

0

0

0

1

2.0204 0 0 2.0204 0

0 0.9996 0 0 0

0 0 1.0200 0 0

2.0204 0 0 2.0204 0

0 0 0 0 0

signY

A test input vector, or probe, is defined asA test input vector, or probe, is defined as

Page 19: Pattern Association  A pattern association learns associations between input patterns and output patterns.  One of the most appealing characteristics

Example 2Consider the three prototype patterns shown.

P1

Pt

P3P2

i. Use the Hebb rule to design a perceptron network that will recognize these three patterns

ii. Find the respond of the networkTo the pattern Pt. Is the response correct?

Page 20: Pattern Association  A pattern association learns associations between input patterns and output patterns.  One of the most appealing characteristics

Example 2

P1

Pt

P3P2

Convert patterns to vectors

P1 =

1-1 1 1

P2=

1 1-1 1

P3 =

-1-1-1 1

-

Pt=

1-1 1 1

t1 = -1 -1

t2 = --1 1

t3 = 1-1

Page 21: Pattern Association  A pattern association learns associations between input patterns and output patterns.  One of the most appealing characteristics

Example 2Determine the weight matrix using the Hebb rule

W = TPT = -1 -1 1 -1 1 -1

1 -1 1 11 1 -1 1-1 -1 -1 1

-3 -1 -1 -1 1 3 -1 -1

=

Find the respond of the networkTo the pattern Pt.

A = hardlims(Wpt) = hardlims

= hardlims -2 -2

-3 -1 -1 -1 1 3 -1 -1

1-1 1-1

= -1-1 P1

Page 22: Pattern Association  A pattern association learns associations between input patterns and output patterns.  One of the most appealing characteristics

Neural networks were designed on analogy with Neural networks were designed on analogy with the brain. The brain’s memory, however, works the brain. The brain’s memory, however, works by association. For example, we can recognise a by association. For example, we can recognise a familiar face even in an unfamiliar environment familiar face even in an unfamiliar environment within 100-200 ms. We can also recall a within 100-200 ms. We can also recall a complete sensory experience, including sounds complete sensory experience, including sounds and scenes, when we hear only a few bars of and scenes, when we hear only a few bars of music. The brain routinely associates one thing music. The brain routinely associates one thing with another. with another.

The Hopfield NetworkThe Hopfield Network

Page 23: Pattern Association  A pattern association learns associations between input patterns and output patterns.  One of the most appealing characteristics

Multilayer neural networks trained with the back-Multilayer neural networks trained with the back-propagation algorithm are used for pattern propagation algorithm are used for pattern recognition problems. However, to emulate the recognition problems. However, to emulate the human memory’s associative characteristics we human memory’s associative characteristics we need a different type of network: a need a different type of network: a recurrent recurrent neural networkneural network..

A recurrent neural network has feedback loops A recurrent neural network has feedback loops from its outputs to its inputs. The presence of from its outputs to its inputs. The presence of such loops has a profound impact on the learning such loops has a profound impact on the learning capability of the network.capability of the network.

Page 24: Pattern Association  A pattern association learns associations between input patterns and output patterns.  One of the most appealing characteristics

The stability of recurrent networks intrigued The stability of recurrent networks intrigued several researchers in the 1960s and 1970s. several researchers in the 1960s and 1970s. However, none was able to predict which network However, none was able to predict which network would be stable, and some researchers were would be stable, and some researchers were pessimistic about finding a solution at all. The pessimistic about finding a solution at all. The problem was solved only in 1982, when problem was solved only in 1982, when John John HopfieldHopfield formulated the physical principle of formulated the physical principle of storing information in a dynamically stable storing information in a dynamically stable network.network.

Page 25: Pattern Association  A pattern association learns associations between input patterns and output patterns.  One of the most appealing characteristics

Single-layer Single-layer nn-neuron Hopfield network-neuron Hopfield network

xi

x1

x2

xnI n

p u

t

S i

g n

a l

s

yi

y1

y2

yn

1

2

i

n

O u

t p

u t

S

i g

n a

l s

Page 26: Pattern Association  A pattern association learns associations between input patterns and output patterns.  One of the most appealing characteristics

The Hopfield network uses McCulloch and Pitts The Hopfield network uses McCulloch and Pitts neurons with the neurons with the sign activation functionsign activation function as its as its computing element:computing element:

XY

X

X

Y sign

if ,

if ,1

0 if ,1

Page 27: Pattern Association  A pattern association learns associations between input patterns and output patterns.  One of the most appealing characteristics

The current state of the Hopfield network is The current state of the Hopfield network is determined by the current outputs of all neurons, determined by the current outputs of all neurons,

yy11, , yy22, . . ., , . . ., yynn. .

Thus, for a single-layer Thus, for a single-layer nn-neuron network, the state -neuron network, the state can be defined by the can be defined by the state vectorstate vector as: as:

ny

y

y

2

1

Y

Page 28: Pattern Association  A pattern association learns associations between input patterns and output patterns.  One of the most appealing characteristics

In the Hopfield network, synaptic weights between In the Hopfield network, synaptic weights between neurons are usually represented in matrix form as neurons are usually represented in matrix form as follows:follows:

where where MM is the number of states to be memorised is the number of states to be memorised by the network, by the network, YYmm is the is the nn-dimensional binary -dimensional binary

vector, vector, II is is nn nn identity matrix, and superscript identity matrix, and superscript TT denotes a matrix transposition.denotes a matrix transposition.

IYYW MM

m

Tmm

1

Page 29: Pattern Association  A pattern association learns associations between input patterns and output patterns.  One of the most appealing characteristics

Possible states for the three-neuron Possible states for the three-neuron Hopfield networkHopfield network

y1

y2

y3

(1, 1, 1)( 1, 1, 1)

( 1, 1, 1) (1, 1, 1)

(1, 1, 1)( 1, 1, 1)

(1, 1, 1)( 1, 1, 1)

0

Page 30: Pattern Association  A pattern association learns associations between input patterns and output patterns.  One of the most appealing characteristics

The stable state-vertex is determined by the weight The stable state-vertex is determined by the weight matrix matrix WW, the current input vector , the current input vector XX, and the , and the threshold matrix threshold matrix . If the input vector is partially . If the input vector is partially incorrect or incomplete, the initial state will converge incorrect or incomplete, the initial state will converge into the stable state-vertex after a few iterations.into the stable state-vertex after a few iterations.

Suppose, for instance, that our network is required to Suppose, for instance, that our network is required to memorise two opposite states, (1, 1, 1) and (memorise two opposite states, (1, 1, 1) and (1, 1, 1, 1, 1). 1). Thus,Thus,

oror

where where YY11 and and YY22 are the three-dimensional vectors. are the three-dimensional vectors.

1

1

1

1Y

1

1

1

2Y 1 1 11 TY 1 1 12 TY

Page 31: Pattern Association  A pattern association learns associations between input patterns and output patterns.  One of the most appealing characteristics

The 3 The 3 3 identity matrix 3 identity matrix II is is

Thus, we can now determine the weight matrix as Thus, we can now determine the weight matrix as follows:follows:

Next, the network is tested by the sequence of input Next, the network is tested by the sequence of input

vectors, vectors, XX11 and and XX22, which are equal to the output (or , which are equal to the output (or

target) vectors target) vectors YY11 and and YY22, respectively., respectively.

1 0 0

0 1 0

0 0 1

I

1 0 0

0 1 0

0 0 1

21 1 1

1

1

1

1 1 1

1

1

1

W

0 2 2

2 0 2

2 2 0

Page 32: Pattern Association  A pattern association learns associations between input patterns and output patterns.  One of the most appealing characteristics

First, we activate the Hopfield network by applying First, we activate the Hopfield network by applying the input vector the input vector XX. Then, we calculate the actual . Then, we calculate the actual output vector output vector YY, and finally, we compare the result , and finally, we compare the result with the initial input vector with the initial input vector XX..

1

1

1

0

0

0

1

1

1

0 2 2

2 0 2

2 2 0

1 signY

1

1

1

0

0

0

1

1

1

0 2 2

2 0 2

2 2 0

2 signY

Page 33: Pattern Association  A pattern association learns associations between input patterns and output patterns.  One of the most appealing characteristics

The remaining six states are all unstable. However, The remaining six states are all unstable. However, stable states (also called stable states (also called fundamental memoriesfundamental memories) are ) are capable of attracting states that are close to them. capable of attracting states that are close to them.

The fundamental memory (1, 1, 1) attracts unstable The fundamental memory (1, 1, 1) attracts unstable states (states (1, 1, 1), (1, 1, 1, 1), (1, 1, 1) and (1, 1, 1, 1) and (1, 1, 1). Each of these 1). Each of these unstable states represents a single error, compared to unstable states represents a single error, compared to the fundamental memory (1, 1, 1). the fundamental memory (1, 1, 1).

The fundamental memory (The fundamental memory (1, 1, 1, 1, 1) attracts unstable 1) attracts unstable states (states (1, 1, 1, 1), (1, 1), (1, 1, 1, 1, 1) and (1, 1) and (1, 1, 1, 1).1).

Thus, the Hopfield network can act as an Thus, the Hopfield network can act as an error error correction networkcorrection network..

Page 34: Pattern Association  A pattern association learns associations between input patterns and output patterns.  One of the most appealing characteristics

Storage capacityStorage capacity is is or the largest number of or the largest number of fundamental memories that can be stored and fundamental memories that can be stored and retrieved correctly. retrieved correctly.

The maximum number of fundamental memories The maximum number of fundamental memories MMmaxmax that can be stored in the that can be stored in the nn-neuron recurrent -neuron recurrent

network is limited bynetwork is limited by

n M max 15.0

Storage capacity of the Hopfield networkStorage capacity of the Hopfield network

Page 35: Pattern Association  A pattern association learns associations between input patterns and output patterns.  One of the most appealing characteristics

The Hopfield network represents an The Hopfield network represents an autoassociativeautoassociative type of memory type of memory it can retrieve a corrupted or it can retrieve a corrupted or incomplete memory but cannot associate this memory incomplete memory but cannot associate this memory with another different memory. with another different memory.

Human memory is essentially Human memory is essentially associativeassociative. One thing . One thing may remind us of another, and that of another, and so may remind us of another, and that of another, and so on. We use a chain of mental associations to recover on. We use a chain of mental associations to recover a lost memory. If we forget where we left an a lost memory. If we forget where we left an umbrella, we try to recall where we last had it, what umbrella, we try to recall where we last had it, what we were doing, and who we were talking to. We we were doing, and who we were talking to. We attempt to establish a chain of associations, and attempt to establish a chain of associations, and thereby to restore a lost memory.thereby to restore a lost memory.

Bidirectional associative memory (BAM)Bidirectional associative memory (BAM)

Page 36: Pattern Association  A pattern association learns associations between input patterns and output patterns.  One of the most appealing characteristics

To associate one memory with another, we need a To associate one memory with another, we need a recurrent neural network capable of accepting an recurrent neural network capable of accepting an input pattern on one set of neurons and producing input pattern on one set of neurons and producing a related, but different, output pattern on another a related, but different, output pattern on another set of neurons.set of neurons.

Bidirectional associative memoryBidirectional associative memory (BAM)(BAM), first , first proposed by proposed by Bart KoskoBart Kosko, is a heteroassociative , is a heteroassociative network. It associates patterns from one set, set network. It associates patterns from one set, set AA, , to patterns from another set, set to patterns from another set, set BB, and vice versa. , and vice versa. Like a Hopfield network, the BAM can generalise Like a Hopfield network, the BAM can generalise and also produce correct outputs despite corrupted and also produce correct outputs despite corrupted or incomplete inputs. or incomplete inputs.

Page 37: Pattern Association  A pattern association learns associations between input patterns and output patterns.  One of the most appealing characteristics

BAM operationBAM operation

yj(p)

y1(p)

y2(p)

ym(p)

1

2

j

m

Outputlayer

Inputlayer

xi(p)

x1(p)

x2(p)

xn(p)

2

i

n

1

xi(p+1)

x1(p+1)

x2(p+1)

xn(p+1)

yj(p)

y1(p)

y2(p)

ym(p)

1

2

j

m

Outputlayer

Inputlayer

2

i

n

1

(a) Forward direction. (b) Backward direction.

Page 38: Pattern Association  A pattern association learns associations between input patterns and output patterns.  One of the most appealing characteristics

The basic idea behind the BAM is to store The basic idea behind the BAM is to store pattern pairs so that when pattern pairs so that when nn-dimensional vector -dimensional vector XX from set from set AA is presented as input, the BAM is presented as input, the BAM recalls recalls mm-dimensional vector -dimensional vector YY from set from set BB, but , but when when YY is presented as input, the BAM recalls is presented as input, the BAM recalls XX..

Page 39: Pattern Association  A pattern association learns associations between input patterns and output patterns.  One of the most appealing characteristics

To develop the BAM, we need to create a To develop the BAM, we need to create a correlation matrix for each pattern pair we want to correlation matrix for each pattern pair we want to store. The correlation matrix is the matrix product store. The correlation matrix is the matrix product of the input vector of the input vector XX, and the transpose of the , and the transpose of the output vector output vector YYTT. The BAM weight matrix is the . The BAM weight matrix is the sum of all correlation matrices, that is,sum of all correlation matrices, that is,

where where MM is the number of pattern pairs to be stored is the number of pattern pairs to be stored in the BAM.in the BAM.

Tm

M

mm YXW

1

Page 40: Pattern Association  A pattern association learns associations between input patterns and output patterns.  One of the most appealing characteristics

The BAM is The BAM is unconditionally stableunconditionally stable. This means that . This means that any set of associations can be learned without risk of any set of associations can be learned without risk of instability.instability.

The maximum number of associations to be stored The maximum number of associations to be stored in the BAM should not exceed the number of in the BAM should not exceed the number of neurons in the smaller layer. neurons in the smaller layer.

The more serious problem with the BAM is The more serious problem with the BAM is incorrect convergenceincorrect convergence. The BAM may not . The BAM may not always produce the closest association. In fact, a always produce the closest association. In fact, a stable association may be only slightly related to stable association may be only slightly related to the initial input vector.the initial input vector.

Stability and storage capacity of the BAMStability and storage capacity of the BAM