home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / e / e065 / 1.ddi / BACKPROP.INS < prev    next >
Encoding:
Text File  |  1991-08-28  |  5.6 KB  |  250 lines

  1. inst4.0        ! Oct-09-90 (backprop.ins) BackProp Builder
  2. !****************************************************************
  3. !*                                *
  4. !*    General Back-Propagation Network Builder        *
  5. !*                                *
  6. !****************************************************************
  7. !
  8. ?&In    1
  9. >bge    CheckOut
  10. @Err    "Back-Propagation MUST have at least one input PE"
  11. :CheckOut
  12. ?BPAa    0            !check for auto-associative
  13. >beq    Hetero1
  14. =&Out    &In
  15. >br    OutOK
  16. :Hetero1                !hetero-associative
  17. ?&Out    1
  18. >bge    OutOK
  19. @Err    "Back-Propagation MUST have at least one output PE"
  20. :OutOK
  21.  
  22. !    *** Load the Control Strategy and LRS if needed ***
  23.  
  24. ?BPFa    0
  25. >bne    CS1
  26. @LdCS    "backprop"        !control strategy
  27. >br    CS2
  28. :CS1
  29. @LdCS    "bkpfast"        !fast control strategy
  30. :CS2
  31. @LdLR    "backprop"        !Load Global Schedule
  32.  
  33. =netn "Untitled"
  34. =DLnF    0            !learn  re-display off
  35. =DRcF    0            !recall re-display off
  36.  
  37. !    *** Build the Input Layer ***
  38.  
  39. @LLdf                !load default layer to mi_layer structure
  40. =LDln    "In"            !layer name
  41. =Lpes    &In            !copy # of input PEs from menu
  42. =Ltrn    "Linear"        !buffer
  43. ?BPGN    0            !Gaussian Noise?
  44. >beq    GN1            !No
  45. =Lnse    "Gaussian"        !Yes
  46. :GN1
  47. =x    100            !place to put layer on screen
  48. =y     40
  49. #Incl    "stdnwgtf.iif"        !standard # weight fields
  50. @LAdd                !add the input layer
  51.  
  52. !    *** Build the functional link Layer if requested ***
  53.  
  54. =n6    LayN            !Index of Last "Input" (preprocessing) layer
  55. ?BPFu    0            !Functional Links requested?
  56. >beq    FLnk1            !No
  57.  
  58. ! Functional Link script is in separate file due to potential
  59. ! patent infringements.  On exit from bckpfunc.iif", n6 must
  60. ! be equal to the index of the last pre-processing layer.
  61. #Incl   "bckpfunc.iif"
  62.  
  63. :FLnk1
  64.  
  65. !    *** Build Hidden Layers ***
  66.  
  67. =n3    0            !hidden layer index
  68.  
  69. :LayerLp            !# Main build layer loop
  70. ?n3    0
  71. >bgt    NotHd1
  72. +n3    1
  73. ?&Hd1    0
  74. >ble    NotHd1
  75. =n4    &Hd1
  76. =BBLC    H1LC
  77. >br    BldLay
  78. :NotHd1
  79. ?n3    1
  80. >bgt    NotHd2
  81. +n3    1
  82. ?&Hd2    0
  83. >ble    NotHd2
  84. =n4    &Hd2
  85. =BBLC    H2LC
  86. >br    BldLay
  87. :NotHd2
  88. ?n3    2
  89. >bgt    OutLay
  90. +n3    1
  91. ?&Hd3    0
  92. >ble    OutLay
  93. =n4    &Hd3
  94. =BBLC    H3LC
  95. :BldLay
  96.  
  97. ?n4    0            !Check #PEs in hidden
  98. >ble    OutLay            !skip to output layer
  99.  
  100. @LLdf                !start with default layer again
  101. =LDln    "Hidden"        !layer name
  102. +LDln    n3            !indexed by layer number
  103. =Lpes    n4            !Number of PEs
  104. =Llrn    BPLf            !Learning Rule
  105. =Ltrn    BPTf            !Transfer function
  106. ?BPGN    0            !Gaussian Noise?
  107. >beq    GN2            !No
  108. =Lnse    "Gaussian"        !Yes
  109. :GN2
  110. ?BPTE    0            !Tolerant Error?
  111. >beq    TE1            !No
  112. =Lerf    "tolerant"        !Yes
  113. :TE1
  114. ?BPDS    0            !Use Default Schedule?
  115. >bne    LRS1            !Yes
  116. @CrSc    LDln            !Create New Schedule
  117. =Llrs    LDln            !Point to it
  118. :LRS1
  119. +y    60            !up higher on display
  120. #Incl    "stdnwgtf.iif"        !standard # weight fields
  121. @LAdd
  122.  
  123. >br    LayerLp
  124.  
  125. ! Now build output layer
  126. :OutLay
  127. @LLdf                !start with default layer again
  128. =LDln    "Out"            !layer name
  129. =Lpes    &Out            !Number of PEs
  130. =n4    Lpes            !Save for instruments
  131. =Llrn    BPLf            !Learning Rule
  132. ?BPLi    0            !Linear Output?
  133. >bne    LinOut
  134. =Ltrn    BPTf            !Transfer function
  135. :LinOut
  136. ?BPGN    0            !Gaussian Noise?
  137. >beq    GN3            !No
  138. =Lnse    "Gaussian"        !Yes
  139. :GN3
  140. ?BPTE    0            !Tolerant Error ?
  141. >beq    TE2            !No
  142. =Lerf    "tolerant"        !Yes
  143. :TE2
  144. ?BPDS    0            !Use Default Schedule?
  145. >bne    LRS2            !Yes
  146. =BBLC    OPLC            !Set up Learn Coefficient
  147. @CrSc    LDln            !Create New Schedule
  148. =Llrs    LDln            !Point to it
  149. :LRS2
  150. +y    60            !up higher on display
  151. #Incl    "stdnwgtf.iif"        !standard # weight fields
  152. @LAdd
  153. =n7    LayN            !Output (highest) layer index
  154.  
  155.  
  156. !Now put in the Connections
  157. =cnwt    1.0            !connection weight
  158. =cnty    WVar            !Variable
  159. =cnsc    WRel            !Relative
  160. =n1    n6            !Initialize Outer Loop counter
  161. +n1    1            !First target layer
  162. =n3    n1            !remember first target layer
  163.  
  164. :OutCnLp            !Outer Connection Loop
  165. ?n1    n7
  166. >bgt    EndConn            !Connections Completed
  167.  
  168. =n0    0            !init inner loop ctr to input layer
  169. =n2    n1            !Upper limit is
  170. -n2    1            !previous layer
  171. ?BPCP    0
  172. >bne    InCnLp            !connect all prior layers
  173. ?n1    n3            !First target layer?
  174. >beq    InCnLp            !connect all prior layers (may be func links)
  175. =n0    n2            !init inner loop ctr to prev. layer
  176.  
  177. :InCnLp                !Inner Connection Loop
  178. ?n0    n2
  179. >bgt    EndInLp            !Break out of inner loop
  180. =SPEl    n1            !destination layer
  181. @SlPE                !select as destination
  182. =NPEl    n0            !source layer
  183. @NrPE                !select as source
  184. @LCFl                !full connections
  185.  
  186. +n0    1            !Increment source layer
  187. >br    InCnLp
  188.  
  189. :EndInLp
  190. ?BPBi    0            !check for bias connections
  191. >beq    NoBias
  192. =NPEl    -1            !bias layer as source
  193. @NrPE                !select as source
  194. @LCFl                !full connections
  195. :NoBias
  196. +n1    1            !Increment destination layer
  197. >br    OutCnLp
  198.  
  199.  
  200. :EndConn
  201.  
  202. !    *** Select Control Strategy & L/R Schedule ***
  203.  
  204. =LnPr    0            !no pruning
  205. @LLsl                !load super layer
  206. ?BPFa    0
  207. >bne    CS3
  208. =Lctl    "backprop"        !backprop control strategy
  209. >br    CS4
  210. :CS3
  211. =Lctl    "bkpfast"        !fast backprop control strategy
  212. :CS4
  213. =Llrs    "backprop"        !backprop L/R Schedule
  214. =Llnn    "train"            !name of learn input
  215. =Lrcn    "test"            !name of recall output
  216. #Incl    "stdioset.iif"        !standard I/O settings
  217. ?Lax1    0            !has Aux1 been set up?
  218. >bgt    Aux1Done        !yes
  219. =Lax1    16            !nominal number of accumulations
  220. :Aux1Done
  221. ?BPAa    0            !check for auto-associative
  222. >beq    Hetero2
  223. +Lflg    LAAs            !auto-associative network
  224. :Hetero2
  225. =Lscl     -1.0            !input  low-value
  226. =Loff     1.0            !input  high-value
  227. =Llow     -0.8            !output low-value
  228. =Lhgh     0.8            !output high-value
  229. =n5    -1.0            !Save for instrument limits
  230. =n6     1.0            !Save for instrument limits
  231. ?BPTf    4            !Is this a Sigmoid?
  232. >bne    BiPolar            !No, - assume bipolar
  233. =Lscl    0.0            !input  low-value
  234. =Llow    0.2            !output low-value
  235. =n5    0.0            !Save for instrument limits
  236. =n6    1.0            !Save for instrument limits
  237. :BiPolar
  238. @SVsl                !save it back
  239. !
  240. #Incl    "stdprobe.iif"        !Standard probe include file
  241. !
  242. =jogl    -.1            !lower limit for jog
  243. =jogh    +.1            !upper limit for jog
  244. =seed    257            !starting seed number
  245. @seed                !set the seed
  246. @Nini                !randomize the network
  247. @EOF
  248.  
  249.