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

  1. inst4.0        ! 8/15/90 
  2.  
  3. !****************************************************************
  4. !*                                *
  5. !*    Self Organizing Map to Layer to Backprop *
  6. !*                                *
  7. !****************************************************************
  8. !
  9. !    Set counter "Aux 1" in the super layer to the number of
  10. !    interations between updating weights with the accumulated
  11. !    deltas.
  12.  
  13. !    *** check that input / hidden PE count is non-zero
  14.  
  15. ?&In    2
  16. >bge    InOK
  17. @Err    "Network MUST have at least two input PE's"
  18. :InOK
  19.  
  20. ?&Hd1    1
  21. >bge    Hid1OK
  22. @Err    "Kohonen Layer MUST have at least 1 row of PE's"
  23. :Hid1OK
  24. =n2    &Hd1            !n2 holds the number of rows in SOM
  25.  
  26. ?&Hd2    1
  27. >bge    Hid2OK
  28. @Err    "Kohonen Layer MUST have at least 1 column of PE's"
  29. :Hid2OK
  30.  
  31. ?&Hd3    1
  32. >bge    Hid3OK
  33. @Err     "Back-prop Hidden Layer MUST have at least 1 PE"
  34. :Hid3OK
  35.  
  36. ?&Out    1
  37. >bge    OutOK
  38. @Err    "Output Layer MUST have at least 1 output PE"
  39. :OutOK
  40.  
  41. !    *** Load the Control Strategy and LRS if needed
  42.  
  43. @LdCS    "som_bp"        !som control strategy
  44. @LdLR    "som"            !som L/R schedule
  45. @LdLR    "som_2hid"        !L/R schedule
  46. @LdLR    "sombpout"        !L/R schedule for hidden layer
  47.  
  48. =netn "Self Organizing Map to Back-Prop v1.00 11-Sep-90"
  49. =DLnF    0            !learn  re-display off
  50. =DRcF    0            !recall re-display off
  51.  
  52. !    *** Build the Input Layer ***
  53.  
  54. @LLdf                !load default layer to mi_layer structure
  55. =LDln    "In"            !layer name
  56. =Lpes    &In            !copy # of input PEs from menu
  57. =Ltrn    "Linear"        !buffer
  58. =x    100            !place to put layer on screen
  59. =y     80
  60. #Incl    "stdnwgtf.iif"        !standard # weight fields
  61. @LAdd                !add the input layer
  62.  
  63. !    *** Build the Kohonen Layer ***
  64.  
  65. @LLdf                !start with default layer again
  66. =LDln    "2-D Kohonen"        !layer name
  67. =Lpes    &Hd1            !number of PEs
  68. *Lpes    &Hd2
  69. =LDnr   &Hd1            !number of rows
  70. =LInL     -0.10            !Init low value
  71. =LInH    0.10            !Init high value
  72. =Lsum    "SOM"            !SOM summation function
  73. =Llrn    "SOM"            !SOM learning rule
  74. =Lcmp    "SOM"            !no output function required
  75. =Llrs    "som"            !som L/R schedule
  76. +y    60            !up higher on display
  77. ?&Hd2    15            !if 15 or more cols, shrink display
  78. >blt    small
  79. ?&Hd2   21        
  80. >blt    medium            
  81. =LDsp    2            !21 or more cols
  82. >br    small
  83. :medium
  84. =LDsp    4            !between 15 and 20 cols
  85. :small
  86. #Incl    "stdnwgtf.iif"        !standard # weight fields
  87. @LAdd                !less than 15 cols
  88.  
  89. !    *** Connect Kohonen to Input Layer ***
  90.  
  91. =SPEl    LayN            !2-D Kohonen layer
  92. @SlPE                !select it as destination 
  93. =NPEl    0            !previous layer
  94. @NrPE
  95. =cnwt    0.0            !connection weight
  96. =cnty    WVar            !variable
  97. =cnsc    WAbs            !absolute
  98. @LCFl                !fully connect to input layer
  99. =n0    LayN            !save 2-D Kohonen layer for later
  100.  
  101.  
  102. !    *** Build the back-prop hidden Layer ***
  103.  
  104. @LLdf                !start with default layer again
  105. =LDln    "Back-prop Hidden"    !layer name
  106. =Lpes    &Hd3            !Proper number of PEs
  107. =Ltrn    "TanH"          !transfer function
  108. =Llrn    "Delta-Rule"        !Delta-Rule learning rule
  109. =Llrs    "som_2hid"        !L/R schedule
  110. =Lscl    2.0            !transform input to hidden layer
  111. =Loff    -1.0            !from 0 to 1, to -1.0 to 1.0
  112. *n2    55            !55 pixels for each SOM row
  113. +y    n2            !move cursor up higher on display
  114. #Incl    "stdnwgtf.iif"        !standard # weight fields
  115. @LAdd
  116.  
  117. !    *** Connect Hidden Layer to Bias & Classification Layers ***
  118.  
  119. =SPEl    LayN            !current layer
  120. @SlPE                !select it as destination 
  121. =NPEl    -1            !near to bias term (source)
  122. @NrPE
  123. =cnwt    0.0            !connection weight
  124. =cnty    WVar            !variable
  125. =cnsc    WAbs            !absolute
  126. @LCFl                !fully connect to bias element
  127. =NPEl    n0            !classification layer
  128. @NrPE
  129. @LCFl                !fully connect to classification layer
  130. =n0    LayN            !save current layer for later
  131.  
  132. !    *** Build the output layer & connect it to prior layer & bias term ***
  133.  
  134. @LLdf                !load default layer to mi_layer structure
  135. =LDln    "Out"            !layer name
  136. =Lpes    &Out            !copy # of input PEs from menu
  137. =Ltrn    "TanH"          !transfer function
  138. =Llrn    "Delta-Rule"        !Delta-Rule learning rule
  139. =Llrs    "sombpout"        !L/R schedule
  140. +y    60
  141. +x    15
  142. #Incl    "stdnwgtf.iif"        !standard # weight fields
  143. @LAdd                !add the output layer
  144. =n7    LayN            !save for stdprobe
  145. =n1    LayN            !save output layer for later
  146.  
  147. =SPEl    LayN            !current layer
  148. @SlPE                !select it as destination
  149. =NPEl    -1            !near to bias term (source)
  150. @NrPE
  151. @LCFl                !fully connect to bias element
  152. =NPEl    n0            !previous layer
  153. @NrPE
  154. @LCFl                !fully connect to previous layer
  155.  
  156. !    *** Select Control Strategy & L/R Schedule ***
  157.  
  158. @LLsl                !load super layer
  159. =Lctl    "som_bp"        !som to class to bp control strategy
  160. =Llrs    "som "            !self organ. map L/R Schedule
  161. =Llnn    "train"          !name of learn input
  162. =Lrcn    "test"          !name of recall output
  163. #Incl    "stdioset.iif"        !standard I/O settings
  164. =Lax1    15            !epoch size
  165. =Lscl     -1.0            !input  low-value
  166. =Loff     1.0            !input  high-value
  167. =Llow     0.0            !output low-value
  168. =Lhgh     1.0            !output high-value
  169. =Lepc    0            !learn count=0
  170. @SVsl                !save it back
  171. @Nini                !initialize the network
  172. !
  173. =n5    0.0
  174. =n6    1.0
  175. =n4    &Out
  176. #Incl    "stdprobe.iif"        !Standard probe include file
  177. !
  178. @EOF
  179.