Sunteți pe pagina 1din 7

A HOPFIELD NETWORK IMPLEMENTATION OF THE VITERBI ALGORITHM FOR HIDDEN MARKOV MODELS CUED/F-INFENG/TR 60

June 17, 1992 S.V.B.Aiyer & F.Fallside

Cambridge University Engineering Department Trumpington Street Cambridge CB2 1PZ England

Email:

svb10 / fallside @dsl.eng.cam.ac.uk Submitted to IJCNN-91-Seattle

reting the iteri lgorithm s form of omintoril optimiztionD this pper shows how it n e implemented on ropeld networkF he implementtion uses frmework developed in our previous ppers ID P whih ensures the network n hieve vlid solutions for muh lrger lss of omintoril optimiztion prolem thn previously onsideredF his lss inludes dynmi progrmming prolems of the type represented y the iteri lgorithmF he im here is to present in detil the tul mpping required to implement the iteri lgorithm on the ropeld networkD together with n nlysis nd justition of itF pinllyD to onrm the theoryD results re presented whih show the ropeld network hieving the sme solution s stndrd dynmi progrmming sed iteri lgorithmD for reognition tsk sed on preEtrined IH stte ridden wrkov modelF
Introduction and Outline

Abstract

ropeld nd nk9s IWVS pper Q estlished the ropeld networkD s n importnt lterntive method of solving omintoril optimiztion prolemsF elthough mny reserhers hve sine proposed wide vriety of uses for the networkD most of these pplitions hve een to solve highly rtiil omintoril optimiztion prolemsD suh s the rvelling lesmn nd qrph rtitioning prolemsF iven in these ses it hs een found tht the network rrely hieves vlid solutions to the prolem it is eing used to solve RD SF his prolem of reliility hs een ddressed in ID P nd frmework for using the network with gurnteed reliility hs een developedF e onsequene of this frmework @see PA is the possiility of using the network to solve hynmi rogrmming type omintoril optimiztion prolems like the iteri lgorithm TF his lgorithm hs diret pplition to ridden wrkov wodelsD speilly for reognition tsks suh s those tht our in speeh proessingF sn this pper the possiility of using the ropeld network to solve dynmi progrmming prolems is developed into n tul implementtion of the iteri lgorithmF he desription of the implementtion is divided into three setionsF he rst introdues the key onepts nd nottion onventions relevnt to the ridden wrkov wodel nd the iteri lgorithmF he seond setion develops nd justies the expressions required to mp the iteri lgorithm onto the prmeters of the ropeld networkF pinlly the lst setion presents nd disusses the experimentl resultsF
The Hidden Markov Model and Viterbi Algorithm

vet t e disrete time vrile whereX t P fI; P; : : : ; M gF vet q1 ; q2 ; : : : ; qN e the sttes of n rww with N sttesF vet A e the N N mtrix of interstte trnsition proilitiesX Aij a r@qj t t CIjqi t tA vet !1 ; !2 : : : : ; !K e set of K output symolsF vet B e the N K output symol proility mtrixX Bij a rwj t tjqi t t vet O e M element vetor whih denotes sequene of M output symolsX Ot a k if the output symol t time t is !k vet p e w element vetor whih denotes sequene of M sttesX pt a i if t time t the rww is in stte qi he iteri lgorithm seeks to nd sequene of sttes p whih mximizes the joint likelihood tht the rww generted O with stte sequene pF vet v@O; pjA; BA denote this joint likelihoodF sing this expression the iteri lgorithm redues toX rg mx p v@O; pjA; BA xote tht y fyes theoremD v@O; pjA; BA a v@OjA; B; pAv@pjA; BAD nd thtX
v@OjA; B; pA a v@pjA; BA a
1

M t M

=1 1

B t t

po

@IA @PA

t=1

A t t+1

pp

Mapping of the Viterbi Algorithm for HMMs onto a Hop eld Network

his mpping hs two si requirementsX (i) e vetor of ones nd zeros @iFe vetor tht orresponds to hyperue ornerA hs to e found tht n uniquely represent the stte sequene pF vet this vetor e denoted v@pAF (ii) e qudrti vipunov funtion of the network output vetor v hs to e foundD whih is of the form 1 T op op op T vF he mtrix Top nd vetor iop must e suh tht E op @v@pAA is E @v A a 2 v T v i monotoni funtion of v@O; pjA; BAF sn other words if v@O; p1 jA; BA ! v@O; p2 jA; BA then
E

op @v@p1 AA

op @v@p2 AA

essuming Top is symmetriD it n e shown tht the ropeld network will grdully hnge v so s to minimize E op @vAF purtherD using the tehnique of vlid suspe onnement developed in our previous pper PD it n lso e ensured tht whenever nl solution is rehedD v is of the form v@pAF winimizing E op @vA sujet to v a v@pA is equivlent to mximizing v@O; pjA; BA over pD hene it is possile for the ropeld network to perform the sme optimiztion opertion s the iteri lgorithmF vet p @N A e the N dimensionl oEordinte vetor given yD p @N Ai a pi a

A general expression for v(p)

&I

if H if

i i

ap T p a

P fI; P; : : : ; N g

@QA

sn eet p @N A is the pth olumn of the N N identity mtrixF N.B. he @N A prt of the vetor p  @N AD speies the numer of elements in this vetor nd the rnge of pF sf this is ovious from the ontext of useD then it will e omittedD leving just p F

he N M dimensionl vetor v@pAD whih orresponds to the stte sequene denoted y pD n now e dened s followsX  p 1 @N A p2 v@pA a  @N A @RA

@N A en lterntive wy of representing p is y N M mtrixF vet suh mtrix e denoted V@pAD nd e dened yX



M

P T T R p

Q U U S

V@pA would expnd s followsD pT

por R stte rwwD with the sequene of sttes q1 q2 q3 q3 q4 q4D the vetors p nd v@pA plus the mtrix

V@pA a p1 @N A

 p 2 @N A

 p M @N A

or V@pAij a pj @N Ai

@SA

v@pAT

H H H H I H H H H I H H H I H H H H I H H H I I; P; Q; Q; R; R I p  1 T  p2 T  p3 T  p4 T  p3 T  p4 T

PI T T R HH

H I H H H

V@pA
H H I H H H I H

H H H I

H H H I

Q U U S

he funtion ve@A @see UAD whih ontentes the olumns of mtrix into one vetorD n e used to mp the N M mtrix V to N M element vetor vX

v a ve@VA A vk a Vij where k a N @j IA C i prom the denitions of v@pA nd V@pA given in @RA@SAD it n e seen tht v@pA a ve@V@pAAF
2

Expressions for Top and iop

he expressions for Top nd iop rely on the use of the uroneker produt nottion developed in P @see U for detiled denitions nd proofs of the uroneker produt identitiesAD with Top eing given y n expression of the formX

Top a I C Tpq C Tpq T

P Q T where Tpq a @P  QA a T R Q
P11

nd where P is M M mtrix DQ is N N mtrixF vet the N M element vetor u nd the N M mtrix U e relted yX u a ve@UAF prom the identity @see UAX @P  QAv a ve@QVPT A where v a ve@VA @TA T it follows tht if U a QV@pAP then u a @P  QAv@pA sine v@pA a ve@V@pAAF reneX

Q P21 P22 Q PM 1 Q PM 2 Q
P12

P1M Q P2M Q PMM Q

Q U U S

v@pAT Tpq v@pA a v@pAT u a


ji a

NM i=1

N M v@pAiui a V@pAij ij i=1 j =1


U

@UA

T pq gonsider the vlue of E pq a 1 2 v@pA T v@pA for the se whereX


P Q

&I

sing @SA nd @QA llows U a QV@pAPT to e written in omponent formX


U

xy a

if i j a I H otherwise log@Axy A

i; j x; y

P fI; P; : : : ; M g P fI; P; : : : ; N g

@VA @WA

N M M N M log@ ki Ap i lj a log@ kp A lj QkiV@pAij lj a i j i j j & kp A if a I ine lj a I only if a C I nd lj a H otherwiseX kl a log@ H if a N M fut from @UA pq a V@pAij ij D hene sine V@pAij a p i X kl a
P A

=1 =1
l

=1 =1

=1

+1

:::M

i=1 j =1

 j

pq a

1 2 1 2

1 pq 1 prom @PA v@pjA; BA a M t=1 Apt pt+1 hene E a 2 log@v@pjA; BAAF his mensX
1 2

N M & V@pAij log@ ip A if a I H if a i j M N M log@ A a log@ p p pi ip


A j +1 j

:::M

=1 =1 1

i=1 j =1

 j

A j +1

1 2

j =1

A j j +1

T pq pq T Av@pA v@pAT Topv@pA a 1 2 v@pA @ I C T C T T pq T pq T 1 1 a 1 2 jv@pAj C 2 v@pA T v@pA C 2 @v@pA T v@pAA 1 a jv@pAj C 1 2 log@v@pjA; BAA C 2 log@v@pjA; BAA T op A1 2 v@pA T v@pA a M C log@v@pjA; BAA
3

@IHA

xow let the N M element vetor iop e relted to the N M mtrix Iop yX iop a ve@Iop AF purther letX Iop ij a log@BiOj A @IIA xoting from @IA tht v@OjA; B; pA a M j =1 Bpj Oj it n now e seen thtX
i=1 j =1
B
j

N M M iopT v@pA a ve@IopAT ve@V@pAA a log@ iO A p i a log@ p O A a log@v@OjA B pAA


 j

j =1

B j j

@IPA

utting @IHA nd @IPA togetherX op op op T v@pA a 1 M log@v@pjA; BAA log@v@OjA; B; pAA 1 E @v@pAA a 2 v@pAT v@pA i 2 O p A B A E op @v@pAA a 1 v j M ; ; log@ @ AA 2 op husD s requiredD E @v@pAA is monotoni funtion of v@O; pjA; BAF @N.B. he prmeter is used to ensure onvergene to hyperue ornerF por disussion of its role see PA pollowing the nlysis developed in PD the enforement of v a v@pA is hieved y onning the network output v to suspe E the vlid suspe E suh tht if v is hyperue orner tht lies in the vlid suspeD then it must e of the form v@pAF he generl eqution of the vlid suspe isX v a s C Tzsv with Tzs a @I  RA where s is onstnt vetor nd Tzs is projetion mtrixD whih projets v onto the zerosum suspeD 1F I is the M M identity mtrix nd R is N N mtrix given yX Rij a ij N zs zs zs zs vet v a T v a ve@V A nd s a ve@SA where V nd S re N M mtriesF sing the identity @TA it n e seen thtX vzs a ve@VzsA a ve@RVA wultiplition y R hs the eet of setting the olumn sums of mtrix to zero @for proof see PAD 1 F sf v a s C vzs then hene the olumn sums of Vzs re lwys zeroF xow let S e given y Sij a N VN a S C Vzs hene if v stises the vlid suspe eqution then V must hve olumn sums equl to i=1 Sij a IF glerly if v is hyperue orner @iFe vetor of ones nd zerosA nd V hs olumn sum of oneD then V must e of the form V@pA nd hene v a v@pAF

Enforcement of v = v(p) by con nement to the valid subspace

Implementation on a Hop eld network and Results of a Simple Experiment

he simplest method of implementtion is to set the onnetion mtrix T nd input is ib of the network s proposed in Q ording to equtions @RHA nd @RQA of PF husX T a @Tzs IA C Top nd ib a s C iop where  is vrile positive prmeter @IQA roweverD for resons of eieny it is etter to use the modied network proposed in P nd shown in pig PF his ws the se for the simple experiment tht ws performed to onrm the theory ehind the mpping of the iteri lgorithmF he tul experiment onsisted of nding the optimum stte sequene for IH stte left to right rww @shown in pig IA to generte sequene of PH output symolsF es simplitionD the totl numer of possile output symols ws restrited to PH nd the output sequene ws ssumed to e !1 !2 !20 X hene O a I; P; : : : ; PHT F he trnsition mtrix A is shown in pig I nd the output proility mtrix B ws generted rndomly sujet to the onstrint tht the sum of eh row ws one @iFe the totl output proility per stte ws oneAF sn dditionD to ensure tht the rww strted in stte q1 nd ended in stte q10 D ll the elements of the rst nd lst rows nd olumns of B were set to zeroD exept for the element B11 nd BNM whih where set to oneF pig Q shows the evolution of the network output from n initil rndom stte to the nl solutionF
4

q1

q2

q3

q10

P HS T H T AaT T R H
:

H:S H H H:S H:S H H H:S H H

H H:S

Q U U U U S

Figure 1: Diagram of left to right 10 state HMM with a 10 10 state transition matrix A
Discussion and Conclusion

he output shown in pigure Q lerly shows the network hieving vlid solutionF purther the stte sequene represented y this solutionD q1 q2 q3 q4 q5 q6q6q6q6q6q7q7q8q8q9q9q9q9q9q10 is in ft the optimumD sine stndrd dynmi progrmming sed iteri lgorithm gives extly the sme stte sequeneF his experiment provides useful illustrtion of some of the fetures intrinsi to the ropeld network pprohF yne of these is the ility of the network to keep tive more thn one solutionF por exmpleD t itertion PHH it n e seen tht two prtil solutions re tive simultneouslyD of whih one eventully domintesF sn dditionD from @IPA nd @IHA it n e seen tht the mpping used netly splits up the joint likelihood funtion into n output sequene prtD v@OjA; B; pAD whih is hndled y the input is term iop D nd stte sequene prt v@pjA; BA whih is hndled y the qudrti term v@pATop v@pAF ine the input is term is n externl input to the networkD it is highly pproprite tht it rries ll the informtion out the externl output sequene whih the rww is trying to reogniseF yverllD these feturesD together with the ovious dvntge of the networks inherent prllel strutureD mke this mpping of the iteri lgorithm onto the ropeld network not just uriosity ut serious pplition with signint potentilF

References

I eiyerDFFfD xirnjnDwD pllsideDpD A Theoretical Investigation into the performance of the Hop eld Model siii rnsF xeurl xetworksD ol xxEID sssue PD pPHREPISD 1990F P eiyerDFFfD xirnjnDwD pllsideDpD A Subspace Approach to Solving Combinatorial Optimization Problems using Hop eld Networks gmridge nivF ingineering heptF ehF eport gihGpE sxpixqGESS 1990 Q ropeldDtFtD nkDhFD Neural Computation of Decisions in Optimization Problems fiologil gyernetisF SPD IEPSD 1985F R ilsonDD wleyDqF On the Stability of the TSP Problem Algorithm of Hop eld and Tank fioE logil gyernetis SVD pTQEUH 1988F S uhngDeD Traveling Salesman Heuristics and Embedding Dimension in the Hop eld Model roF stgxx VWD ol sD pSIQESPHD 1989F T vevinsonDD Structural Methods in Automatic Speech Recognition roF siiiD olF UQD xoF IID xovF 1985F U qrhmDeD Kronecker Products and Matrix Calculus: with Applications illis rorwood vtdD ghihE ester 1981F

v
(1) (2)

v=s+Tzsv
(3)

. v=Topv+iop

(1) rojetion of v onto vlid suspe v a s C Tzsv where Tzs a @I  RA v (2) xonliner symmetri rmp9 threshold funE tions onstrining v to the unit hyperueF (3) ghnge in v given y the grdient of the optiE miztion energy term E op D with v a tv

Figure 2: Schematic diagram of modi ed network implementation

state 1

state 1

t=20 state 10 t=1


state 10 t=1

t=20

stertion IH E E op a IVV:S

stertion PHH E E op a IRP:U

state 1

state 1

t=20 state 10 t=1 state 10 t=1

t=20

Figure 3: 3D Mesh Plots showing the evolution of V (the matrix representation of the network output vector v, where vec(V) = v) in a simulation of the modi ed network implementing the Viterbi algorithm for a 10 state HMM and sequence of 20 output symbols. The nal solution at iteration 800 is identical to the solution obtained by dynamic programming, i.e. it is the global optimum. (N.B. The vertical axis scale changes for each mesh plot.)

stertion QSH E E op a VI:W

stertion VHH E E op a RV:I

S-ar putea să vă placă și