Reti neuronali artificiali dinamiche Dynamic Artificial Neural Networks

Preview:

DESCRIPTION

Reti neuronali artificiali dinamiche Dynamic Artificial Neural Networks I campioni: sequenze di vettori Pattern: sequences of vestors X =( x (n),n=1 N) Esempi:Segnali temporali (vocali, audio, radar, ecc.), Segnali immagine (fisse o in movimento-video) - PowerPoint PPT Presentation

Citation preview

Reti neuronali artificiali dinamiche Dynamic Artificial Neural Networks

I campioni: sequenze di vettori Pattern: sequences of vestors X=(x(n),n=1N)

Esempi:Segnali temporali (vocali, audio, radar, ecc.),Segnali immagine (fisse o in movimento-video)Examples: Temporal signals (speech, audio, radar, etc.)Image signals (pictures, video signals)

I campioni di un stessa classe hanno generalmente lunghezze diversePattern of the same class do not need to have the same length

L’apprendimento, ma non il riconoscimento, può richiedere la segmentazione del segnaleLearning, but not recognition, may require the pattern segmentation

x2

r(t)

x(t)t=10

t=0

Tr

Tx

x1

D(r,x) = |r(t)-x(t)|dt

Distorsione temporale fra r(t) e quello di x(t);Time warping between r(t) and x(t)Tr= r((t)), ma (t) non è definita ;but (t) is not definedGr(x) = min [ D(x,Tr); T C]

C è l’insieme delle distorsioni (t); C is the set of the time warping

- non significativa, not meaningful

t

x(t)

T è l’ insieme dei ritardi 0 e delle distorsioni

Gr(x) = min [ |x()-Tr()| d ; T C]

-

x(t)

t

r(t)

0

T is the set of delay 0 and time warping

Richiamo al riconoscimento di segnali con HMM (Hidden Markov Model)

Review of HMM for temporal signal recognition

Principio di ottimalità (Bellman):“In un sistema a stati finiti la scelta ottimale attuale è indipendente dalle scelte ottimali precedenti”Optimality principle (Bellman):“The optimal local choice in a finite state system is independent of the preceeding optimal choices”

Catena di Markov Markov Chain

S B C E

b)

PAA PBB

PAC PBAPCB

PCC

E=K

B=k

C

S

Grafo degli stati; States Graph : Sk,n= (sk,n) ( k=1K e n=1N)

Cott(S k,n) = Ck,n + argmin[C ott(S j,n-1)+t jk; j precedente di k; j preceding k]

dove; whereCk,n= (k-xn)2k2 tjk=-log(Pjk)

1 n-1 n N

Sk,n

HMM/ w1

HMM/ w2

HMM/ w3

WLC

WLC=Word Link Controller

w1

Id1

c2

w3

Id2

c2+p3

w2

Id2

c2+p2

w1

Id2

c2+p1

Address Point to Terminatedword

AccumulatedCost

Properties

Id4 Id2 w1 C4 Last wordrecognised

Id3 Id1 w2 C3

Id2 Id1 w1 C2

Id1 - w2 C1 First word recognised

x1

x2

X(1)

X(2)

X(n+1)X(n)

X(N)

x1

x2

X(1),1

X(2),2

X(n+1),n+1

X(n),n

X(N),N

nTraiettorie nello spazio delle caratteristiche Trajectories in the pattern space (a)e nello spazio caratteristiche-tempo and in the pattern-time space (b)

1

2

n

n+1

N

a)

b)

wj

x(n)sj(n)

sj(n) = wj x.(n-1)

Connessione sinaptica dinamica elementare;Basic Dynamic Synaptic Connection

x(n)x(n-1) x(n-2) x(n-3)

w0 w2

w3w1

z-1 z-1 z-1

Connessione sinaptica dinamica; Dynamic Synaptic Connection

+

j w41

wj

x(n)sj(n)

x.(n)=[x.(n),...,x.(n-P),1)]T; wT=[w0,...,wP+1,]

sj(n) = h wh.x.(n-h) = wj. x(n)

xi(n)x(n-1) x(n-2) x(n-3)

w0 w2

w3w1

z-1 z-1 z-1

Nodo con connessione sinaptica dinamica (FIR non lineare)Node with dynamic connections (Non linear FIR)

+

jw4

1

xi.(n)=[x.(n),...,x.(n-P),1)]T; wjT=[wj0,...,wj(P+1),]

sj(n) = h wjh.xi.(n-h) = wj. xi(n)

zj(n) =(sj(n))

(.)

wj

zj(n)sj(n)

Tipologie di RNA dinamiche Dynamic ANN typologies

1) RNA a ritardo (Time-delay Neural Networks: TDNN)1.1) TDNN a ritardo concentrato (Focused TDNN)1.2) TDNN a ritardo distribuito (RNA convoluzionale) Distributed TDNN (Convolutional TDNN)2) RNA ricorrenti; Recursive Dynamic ANN

3) RNA spazio-temporali; Spatiotemporal ANN

4) Reti di Hopfield; Hopfield Networks5) Memorie associative; Associative Memories

Apprendimento supervisionato; Supervised Learning a) a epoche; epoch learningb) in tempo reale; real time learning

x(n) x(n-1) x(n-2) x(n-3)

y(n)

T T T

x(n-4) x(n-5)

T T

TDNN a ritardo concentrato; Focused TDNN

RNAMLP, SOM

x(n) x(n-1) x(n-2) y(n-1)

y(n+1)

T T

y(n)

T T

RNA ricorrente; Recursive Dynamic ANN

RNAMLP, SOM

Strato d’ingresso Strato di contestoInput layer Context layer

1 j P

wj

x(n)

RETE SPAZIO-TEMPORALE ;Spatiotemporal NetwokAnalogia topologica con le SOM e HMMTopological analogy with SOM and HMM

y(n)

segnale diAbilitazione;Start signal

segnale diriconoscimento;End signal

MLP

Input memory of length Q; lunghezza del campo ricettivo; length of the receptive field: L= Q+1Nodi dello strato nascosto; nodes of the hidden layer: M= Q+1 numero massimo di pesi diversi; maximum number of different weights: (Q+2)M;

TDNN completamente connessa; Completed connected TDNN x(n) scalare o vettore; scalar or vector

x(n) T T T T

1 i M

y(n)

x(n-Q)

yi(n)

zi

i

xn T T

T T T T

yc

T

xn-1xn-2

strato di convoluzioneConvolution layer

strato di integrazioneIntegration layer

strato di separazionedelle classiClass separation layer

TDNN convoluzionale a pesi distribuiti; Distributed weights convolutional TDNN

x(n)

y

T T T x(n-5)T T

11 1 1z1 z4

w2

w1w3

Espansione temporale di una TDNN convoluzionaleTime expansion of a convolutional TDNN Finenstra temporale e lunghezza del campo ricettivo: P=6; Time window and length of the receptive field: P= 6 numero di pesi; number of weights: Q=3 Nodi dello strato nascosto; number of nodes of the hidden layer: M= P-Q+1=4

M

Addestramento delle TDNN; Supervised learning of TDNN

a) TDNN a ritardo concentrato o convoluzionale il segnale desiderato (classe) può essere presentato solo al termine dell’ epoca

la sequenza è segmentata, addestramento come MLP spaziale addestramento a epoche

b) TDNN a ritardo concentrato il segnale desiderato è presentato in ogni istante processo stazionario, addestramento sequenziale come MLP addestramento in tempo reale Esempio: predittore non lineare

c) TDNN convoluzionale il segnale desiderato è presentato in ogni istante processo stazionario, addestramento sequenziale come MLP

addestramento in tempo reale

n1n0

n

Addestramento delle TDNN; Supervised learning of TDNN

a) Riconoscimento di segnali:Addestrameno a epoche con retropropagazione temporale dell’errore totale ed aggiornamento globale: n0<n<n1) Epochwise learning with total error back

propagation and global updating: n0<n<n1

c) Predittori:Addestramento in tempo reale con errore locale ed aggiornamento in tempo reale; Realtime learning with local error and real time updating

x(n)x(n-1) x(n-2) x(n-3)

T T T

x(n-h) x(n-12)

T T T T

yb yd yg

16

8

3

TDNN per il riconoscimento dei fonemi “b, d, g” ,Processi non stazioanriTDNN for “b,d,g” phonemes recognition, Npn stationary processes

T=20ms(12x20ms = 0,24s)

X(n)

x1(n)

x16(n)

1

8

1

3

Estenzione delle TDNN convoluzionali a segnali immagineConvolutional TDNN for image signals

x(n)x(n-1) x(n-2) x(n-3)

w1 w2w3

w4

x’(n+1)

wj= e(n+1) ’(x(n+1)x(n-i)

+

z-1 z-1 z-1

(.)

Predittore non lineare (processo stazionario); Addestramento in tempo reale

Non linear predictor (stationary process);; realtime learning

y*(n)=x(n+1) e(n+1)_

x(n)

y(n)

T T Tx(n-5)

T T

M

v1 v4

w2

w1w3

(n) = [y*(n)-y(n)]’[v(n)] = e(n)’[v(n)]; vi(n+1) = vi(n)+(n)zi(n);

i(n-k)= (n-k)vi(n)’[zi(n-k)] i=14 (gradiente locale del nodo i di H1)wk(n+1) = wk(n) + 1/M[ ii(n-3)x(n-3-k-i+1)] per k=1,2,3

Addestramento in tempo reale di TDNN convoluzionale a uno stratoReal time learning of a single hidden layer convolutional TDNN

zi(n)

(.)=

vi

H1

v2

v3

y(n)

x1(n)

TDNN convoluzionale a due strati ( processi non stazionari)Two hidden layer convolutional TDNN (non stationary processes)

(.)

(.)

(.)

v1

z1(n)w1

x3(n) w3

w2z-1

z-1

z-1

(.)+

x2(n)

+

s(n)

Etot(W,v)= 1/2n (y*(n)-y(n))2

z2(n)

z3(n)

Processing equations

Output layer (OL): y(n)=[s(n)]; s(n)= jzj (n) Tvj

OL dynamic synaptic weights: vj=[v0j,...,vPj,]Vector activity of node i of the hidden layer (HL): zj(n)=[1,zj(n),…,zj(n-P)]; zj(n)= [sj(n)]; sj(n)= wi

Txi(n); HL synaptic weights: wi=[w0i,...,wPi,]Input vector i: xi

(n)=[1, xi(n),...,xi(n-P)];

Local gradient of the OL: (n)= e(n)’[s(n)]; vj(n+1)= vj(n)+(n)zj(n)Local gradients of the HL:j(n-Pj)=[j(n),…, j(n-P) ];

j(n- Pj)= ’[sj(n- Pj)] j(n- Pj)Tvj Updating expression: wji(n+1)=wji(n)+i(n- Pj)Txi(n- Pj)

Real time learning of a two hidden layers convolutional TDNN

+wij

wjj

jxi(n)

s(n)(s)

y(n)

T

+

wij

wjj j

yi(n)

s(n)(s)

yj(n)

T

+

wji

whi is(n)

(s)

y1(n)T

yk(n)

Neuroni artificiali dinamici: retroazione locale (a) e con interazione (b)Dynamical Articial neurons: local feedback (a), interacting nodes (b)

a)

b)

wji >> wij

wiiwkj

w1i

yh(n)

y1(n)

w1j

-1< wjj <1

u(n)

y1(n+1)

T T

11 2

w12

w11 w22

.

.

y2(n+1)

y2(n)y1(n)

w21

v12 v22

v11 v21

RNA dinamica elementare; Basic Dynamic ANN (Flip-flop)

1 2

u

y1

.y2

x(n) x(n-1) x(n-2) y(n-1)

y(n+1)

T T

y(n)

T T

RNA ricorrente; Recursive Dynamic ANN

RNAMLP, SOM

Strato d’ingresso Strato di contestoInput layer Context layer

n0 n1n1 n0

nH

n

Metodi di addestramento per RNA dinamicheRiconoscimento di segnali Retropropagazione temporale a epoche (aggiornamento globale: n0<n<n1) Pattern recognition Backpropagation through time (global learning

n0<n<n1)

b) Predizione Retropropagazione in tempo reale troncata a n-H ( aggiornamento con retropropagazione del solo errore istantaneo)

Prediction Real time trunkated backpropagation at n-H (updating with the current error)

c) Predizione Addestramento in tempo reale con l’errore locale Prediction Realtime updating using the current error

u(n)

y1(n+1)

w12

w1

w2 y2(n+1)y2(n)

y1(n)

w21

v1

v2

u(n+1)v1

v2

Espansione temporale per l’ addestramento della rete Flip/flopTime expansion for the Flip/flop network updating

w1

w2

y2(n-1)

y1(n-1)

..w1

w2

s1(n)= u(n)v11+ v12+ y1(n-1)w1+y2(n-1)w12

s2(n)= u(n)v22+ v21+ y1(n-1)w21+y2(n-1)w2

y1(n)=(s1(n)); y2(n)=(s2(n))

E(v,w,n)= ½[ (y1*(n)-y1(n))2+ (y2*(n)-y2(n))2]

w12

w21

w12

u(n-1)

v1

v2

w1

w2

.w21

w12

u(n)

x(n)

x(n+1)

(n)T=[x(n), u(n)] con x(n) = (xj(n);j=1M

wjT =[waj ,wbj], W

=[waj ,wbj,j=1M]

x(n+1)=(WaTx(n)+Wb

Tu(n)]=[WT(n)]

y(n)=Cx(n)

j

wbj

z-1

C z-1 y(n)

Struttura canonica della rete ricorrenteCanonical structure of a recurrent ANN network

waj

u(n)

x(n-1)

y(n)

Sviluppo temporale della struttura canonica per adddestramento con retropropagazione nel tempoTime expansion of the canonical structure for backpropagation through time learning

Wa

Wb

x(n+1)

u(n+1)

y(n+1)

y*(n)y*(n+1)

e(n)e(n+1)

Wa

Wb

_

+

_

+

(n)T=[x(n), u(n)]; x(n+1)=(WaTx(n)+Wb

Tu(n)]=[WT(n)];

x(n)

u(n)

x(n) x(n+1)

y(n)

u(n0)

x(n0)

y(n0)

x(n0 +1)

RNA

RNA

u(n0 +1)

y(n0 +1)

RNA

u(n1-1)

y(n1-2)

x(n1-1)RNA

u(n1)

y(n1)

x(n1)RNA

T

RNA ricorrente con sviluppo temporale da n0 a n1

Bachpropagation through from n0 to n1 for a Recursive ANN

x(n0 +2)

x(n1 -2)

y*(n0 ) y*(n0 +1) y*(n1-2) y*(n1)

u(n)

x(n)

y(n+1)

x(n+1)

y(n)

u(n0)

x(n0)

y(n0 +1)

x(n0 +1)

RNA

RNA

u(n0+1)

y(n0 +2)

RNA

u(n1-2)

y(n1-1)

x(n1-1)RNA

u(n1-1)

y(n1)

x(n1)RNA

T

x(n0 +2)

x(n1 -2)

u(n)u(n)

u(n-1)

Espansione temporale di RNAD mista TDNN/recursiva; Time expansion of a mixed TDNN/recursive Dynamic ANN

e1 eh=y*h- yh eM

whj

wji

O

H2

H1

I

’(sh)

’(sj)

wik

’(si)

yj

whj= h yjh= ehs’(sh)

ej=h whj

j= ej’(sj)wji = j yi

yi

ei=j j wji

i= ej’(sj) x1 xk xN

wik = i xk

Rete di retropropagazione dell’ errore per RNA staticheBackpropagation network for feedforward ANN

1 h M

1 j MH2

1 i MH1

1 k N

yh

e j(n0)

j(n) = ’(s j(n))[ej(n) +hwahjiTh(n+1)]; h(n1+1)=0

waji = nj(n+1) xi(n); wbji = nj(n) ui(n);i,j= 1,…,N; n=n0+1,...,n1

h(n0+1)

e j(n)=y*(n)-y(n)

h(n+1)

e j(n1)h(n) j(n1)

u(n0), x(n0-1)

Rete e formule per l’ addestramento a epoche con retropropagazione temporaledi solito si impone solo y*(n1)=1Backpropagation network and updating expressions for backpropagation through learning; usually only y*(n1)=1 is given

nn0n1

u(n), x(n-1) u(n1), x(n1-1)

Addestramento in tempo reale e retropropagazione temporale troncataRealtime updating with truncated temporal backpropagation

h(n-H+1) h(l+1)

e j(n)h(n-H) h(l) h(n1)

j(n) = ’(sj(n))ej(n)

j(l) = ’(s j(l))[hwhj(l)Th(l+1)]; e per n-H <l <n

waji(n)= lj(l) xi(1 -1); con n-H +1<l <nwbji(n)= lj(n) ui(1 -1); con n-H +1<l <n

u(n-H), x(n-H-1) u(l), x(l-1) u(n), x(n-1)

nn-H l

u(n)

y(n)

Addestramento in tempo reale: Percettrone ricorrente Realtime learning: Recursive Perceptron

x(n)=y(n-1)T

vw

y(n)=[s(n)]; e(n)=y*(n)-y(n); s(n)=w(n) u(n)+v(n)x(n); Stato della rete; network state: x(n) = y(n-1)

Aggiornamento del peso d’ingresso; input weight updating: w(n) = e(n) dy(n)/dw = e(n) ’(s(n) ds(n)/dw = (n) u(n) Aggiornamento del peso di contesto; context weight updating:

v(n) =e(n) dy(n)/dv = e(n) ’(s(n)).ds(n)/dv = (n)[x(n)+v(n) dx(n)/dv]

dx(n)/dv = dy(n-1)/dv =’[s(n-1)][x(n-1)+v(n-1) dx(n-1)/dv] condizione iniziale; initial condition: dx(1)/dv = k

u(n)

x(n)

x(n+1)

(n)T=[x(n), u(n)] con x(n) = (xj(n);j=1M

wjT =[waj ,wbj], W

=[waj ,wbj,j=1M]

x(n+1)=(WaTx(n)+Wb

Tu(n)]=[WT(n)]

y(n)=Cx(n)

jwbj

z-1

C z-1 y(n)

Struttura canonica della rete ricorrenteCanonical structure of a recurrent ANN network

waj

Addestramento in temporeale (Vedi: S. Haykin “Neural Networks” Cap. 15.8)

E(W,n)=1/2e(n)Te(n); e(n)=y*(n)-y(n)= y*(n)-Cx(n)

dE(W,n)/dwj=[de(W,n)/dwj]Te(n) = -e(n)TCdx(n)/dwj

aggiornamento dei pesi di contesto; updating of the weights of the context layer:wj(n)= -dE(W,n)/dwj= e(n)TCdx(n)/dwj

Matrice delle derivate dello stato; matrix of the state derivatives:

j(n) = dx(n)/dwj =dx(n)/ds(n).[ds(n)/dwj]

wj(n) = e(n)T Cj(n)

Calcolo di; computation of: j(n)

j(n) = dx(n)/dwj=dx(n)/ds(n).[ds(n)/dwj]

x(n+1) = ((w1T (n)),...,(wj

T (n)),...,(wqT (n))

s(n+1)=W(n)T(n) = wa(n)Tx(n)+wbTU(n-1)

derivando si ha la recursione; recursive expression:

j(n)= (n-1)[Wa(n-1)j(n-1)+Uj(n-1)] con j(0)=0

Dove; where:(n)= diag[’(w1

T (n)),...,’(wjT (n)),...,’(wq

T (n)]

Uj(n)T=[0,..., (n)T,...,0] alla j-esima riga

x1

x2

W1

W3

W2

W4

u(n)

Rete spazio temporale: struttura globale analoga alle SOM e HMMSpatiotemporal network: structure similar to SOM and HMM

w4w3wi

w1

1 2 3 4

u(n)Conness. con ritardo

Reset

0yi(n)

sK

si

si-1

s1

Addestramento ad epoche della RNA spazio-temporale: vedi HMMBackpropagation through time of a spatiotemporal ANN

vi-1,i

vi

u(n)

wi

u(n+1)

vi-1,i

vi

u(n-1)

vi-1,i

vi

u(N)u(1)

vi (n)

u(n)

wi(n)

xi(n+1)i

C z-1 y(n)

vi-1,i (n)

Addestramento in tempo reale della RNA spazio-temporaleRealtime learning of a spatiotemporal ANN

(a) RNA spazio-temporale con attivazione in cascata; Spatiotemporal ANN with cascade activation; (b) nodo; node.Addestramento non supervisionato (metodo di Hecht-Nielsen) Unsupervised learning (Hecht-Nielsen Method)

wKwiw2w1

y0(n)=11

y1(n)2 yi-1(n)

iyi(n)

K

yN(n)yN-1(n)

x(n)yi(n)

+

i

si(n)

u(si-Si)yi-1(n)

ai

x(n) wi) u(Ri )

a)

b)

yi-1(n-1)

x1

x2

w1

w3

w2

xx

x

o

x

SOM

RNAHopfield

w2

x

n=0 n >0

w(n) w2

w(0)=x

Classificatore staticoStatic classifier

Classificatore DinamicoDynamic classifier

RNA dinamiche per il riconoscimento di campioni staticiDynamic ANN for static pattern recognition

w3(n)

Rete di Hopfield; Hopfield Network

w2(n) w1(n)

w3(0) = x3Tiji

j

w2(0) = x2

w1(0) = x1

Tij =Tjin> 0n =0