home *** CD-ROM | disk | FTP | other *** search
- csv3.0 !file format is Control Strategy Version 3.0
- ! 05-Jun-89 (pnn.nnc) Probabilistic Neural Network
- !************************************************************************
- !* *
- !* Probabilistic Neural Network Control Strategy *
- !* *
- !************************************************************************
- !
- ! *** Recall ***
- !
- !MASK label op-code operands comment
- L_saR_sa trace aux3 ! set trace option to aux3
- L_saR_sa cset recall,1 ! recall count
- !
- ! Initialize ce field with 1/N
-
- L_saRi_a lset out,-2 ! pattern layer
- L_saRi_a math e=0 ! zero out error field
- L_saRi_a lset out,-1 ! summation layer
- L_saRi_a math e=0|setb
- L_saRi_a math backp ! backprop 1's through 1/N
- L_saRi_a lset out,-2 ! pattern layer
- L_saRi_a math ce=e|e=0 ! Store 1/N in ce field
-
- L___R_sa lset in ! input layer
- L___R_sa io read ! get input data
- L___R_sa @rloop math sum ! perform sum (for norm layer)
- L___R_sa math rnoise|tran|output
- L___R_sa lset cur,1 ! next layer
- L___R_sa lcmp out ! at output layer ?
- L___R_sa blt @rloop ! loop till done
- L___R_sa io rcltst
- L___R_sa math sum|ce=e|tran|output|e-=w|swap
- L___R_sa io write ! write results
- L___R_sa br @exit ! skip to end
- !
- ! *** Learning ***
- !
- L_saR___ lset in ! start at input layer
- L_saR___ io lrnin ! get input data
- L_saR___ @ll1 math e=0|w=0 ! clear error & output
- L_saR___ lcmp out ! done?
- L_saR___ lset cur, 1 ! next layer
- L_saR___ blt @ll1 ! do it again
- L_saR___ lset out ! explicitly set for DPACK's sake
- L_saR___ io lrnout ! get desired output
- !
- ! back-propagate the error to control which PEs learn
- !
- L_saR___ math backp ! bkp error to summation lyr
- L_saR___ lset cur,-1 ! summation layer
- L_saR___ math backp ! bkp error to pattern lyr
- !
- ! perform a normal recall until we hit the pattern layer
- !
- L_saR___ lset in ! start with input layer
- L_saR___ @ll2 math sum ! sum (for Norm layer)
- L_saR___ math lnoise|tran|output|learn
- L_saR___ lset cur,1 ! next layer
- L_saR___ lcmp out,-2 ! are we at pattern layer?
- L_saR___ blt @ll2 ! not yet
- !
- L_saR___ math sum|lnoise|tran|gate|output|learn ! Learn
- L_saR___ lset cur,1 ! summation layer
- L_saR___ math learn ! weights = 1/N
- !
- ! Now, re-do the math, but see what category it really gets
- !
- L_saR___ lset cur,-1 ! pattern layer
- L_saR___ @ll3 math sum|lnoise|tran|output
- L_saR___ lset cur,1 ! next layer
- L_saR___ lcmp out ! are we at output layer?
- L_saR___ blt @ll3 ! not yet
- L_saR___ math sum|lnoise|tran|output ! final output
- !
- ! Tidy up, and tell what actually happened
- !
- L_saR___ io lrnrslt ! tell userio what happened
- LisaRisa @exit trace 0 ! turn off any trace function
-