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

  1. inst4.0        !  (LVQ.ins)  Linear Vector Quantization
  2. !*********************************************************************
  3. !*                                         *
  4. !*    Linear Vector Quantization (LVQ) Network Builder             *
  5. !*                                         *
  6. !*********************************************************************
  7. !
  8.  
  9. !    *** check that input / output PE count is non-zero
  10.  
  11. ?&In    1
  12. >bge    InOK
  13. @Err    "LVQ MUST have at least 1 input PE"
  14. :InOK
  15. ?&Hd1    1
  16. >bge    Hid1OK
  17. @Err    "LVQ MUST have at least 1 PE per category"
  18. :Hid1OK
  19. ?&Out    2
  20. >bge    OutOK
  21. @Err    "LVQ MUST have at least 2 output categories"
  22. :OutOK
  23.  
  24. !    *** Load the Control Strategy and LRS if needed
  25.  
  26. @LdCS    "lvq"            !control strategy
  27. @LdLR    "lvq"            !L/R schedule
  28.  
  29. =netn   "LVQ instanet  
  30. =DLnF    0            !learn  re-display off
  31. =DRcF    0            !recall re-display off
  32.  
  33. !    *** Build the Input Layer ***
  34.  
  35. @LLdf                !load default layer to mi_layer structure
  36. =LDln    "In"            !layer name
  37. =Lpes    &In            !copy # of input PEs from menu
  38. =x    100            !place to put layer on screen
  39. =y     80
  40. =n3    5            !PE Spacing
  41. *n3    &Hd1
  42. *n3    &Out
  43. /n3    &In
  44. ?n3     1
  45. >bge    n3OK
  46. =n3     1
  47. :n3OK
  48. =LDsp    n3
  49. #Incl    "stdnwgtf.iif"        !standard # weight fields
  50. @LAdd                !add the input layer
  51.  
  52. !    *** Build the Kohonen Layer ***
  53.  
  54. @LLdf                !start with default layer again
  55. =LDln    "Kohonen"        !Kohonen layer
  56. =Lsum    "lvq"            !Summation Function
  57. =Lcmp    "lvq"            !Output Function
  58. =Llrn    "lvq"            !Learn Function
  59. =Llrs    "lvq"            !learning recall schedule
  60. =Lpes    &Hd1            !Number of PE's = &Hd1 * &Out
  61. *Lpes    &Out
  62. +y    100            !up higher on display
  63. =LDsp    5            !PE Spacing
  64. #Incl    "stdnwgtf.iif"        !standard # weight fields
  65. @LAdd
  66.  
  67. !    *** Connect Kohonen Layer to Input Layer ***
  68.  
  69. =SPEl    1            !Destination = Kohonen Layer
  70. @SlPE
  71. @NrPE
  72. =cnwt    0.0            !connection weight = 0.0
  73. =cnty    WVar            !fixed
  74. =NPEl    0            !Source = Input Layer
  75. @NrPE
  76. @LCFl                !fully connect to input layer
  77.  
  78. !    ***  Add an Output Instrument between input & Kohonen Layers    ***
  79.  
  80. +x    100            !to right on display
  81.  
  82. =SPEl    1            !Destination = Kohonen Layer
  83. @SlPE
  84. @NrPE
  85. =NPEl    0            !Source = Input Layer
  86. @NrPE
  87. =PNam    NPEl            !Write source layer number to name
  88. +PNam    "->"
  89. +PNam    SPEl            !Append destination layer number to name
  90. @PbAS                !Add Probe
  91. @PALC                !Add Layer Connection to probe
  92.  
  93. @ILdD                !load default instrument
  94. =ITit    "Layer "        !Instrument title
  95. +ITit    NPEl            !Append source layer number to title
  96. +ITit    "->"            !Instrument title
  97. +ITit    SPEl            !Append destination layer number to title
  98. =Ivmn    0.
  99. =Ivmx    1.
  100. =Ignx    &In
  101. =Inpl    &In
  102. *Inpl    &Hd1
  103. *Inpl    &Out
  104.  
  105. ! height and width:
  106. =Iwdt    100            !Width of graph
  107. =Ihgt    175            !height of graph
  108.  
  109. =IGVr    "Weight"
  110. =IGTy    "Bar"
  111. =ITMd    0            !No transformation
  112. =IRcA    0            !Not active in recall
  113. =ILDv    10            !Every 10 iterations
  114. =IPrb    PNam            !Point to probe
  115. @IAdd        
  116.  
  117.  
  118. !    *** Build the output layer  ***
  119.  
  120. =x    100
  121. @LLdf                !load default layer to mi_layer structure
  122. =LDln    "Out"            !layer name
  123. =Lpes    &Out            !copy # of input PEs from menu
  124. =Lsum    "sum"            !Standard Summation Function
  125. =Ltrn    "linear"        !Transfer Function
  126. =Lcmp    "direct"        !Output Function
  127. +y    100            !up higher on display
  128. =LDsp    5            !PE Spacing
  129. *LDsp    &Hd1
  130. #Incl    "stdnwgtf.iif"        !standard # weight fields
  131. @LAdd                !add the output layer
  132. =n7    LayN            !save for stdprobe
  133.  
  134. !    *** Connect Kohonen Layer to Output Layer ***
  135.  
  136. =cnwt    1.0            !connection weight = 1.0
  137. =cnty    WFix            !fixed
  138. =SPEl    2            !Destination = Output Layer
  139. =SPEn    0            !Output Layer PE index
  140. =NPEl    1            !Source = Kohonen Layer
  141. =NPEn    0            !Kohonen Layer PE index
  142. :L1 
  143. =n1    0            !&Hd1 count
  144. :L2 
  145. @SlPE                !select next PE in output layer
  146. @NrPE                !select next PE in Kohonen layer
  147. @PCon                !Connect Kohonen PE  to output PE
  148. +n1    1            !increment &Hd1 count
  149. +NPEn    1            !increment Kohonen Layer PE index    
  150. ?n1    &Hd1            !check for loop end
  151. >blt    L2 
  152. +SPEn    1            !increment output Layer PE count
  153. ?SPEn    &Out
  154. >blt    L1 
  155.  
  156.  
  157. !    *** Select Control Strategy & L/R Schedule ***
  158.  
  159. @LLsl                !load super layer
  160. =LDnd    3            !Force network display
  161. =Lctl    "lvq"            !control strategy
  162. =Llrs    "lvq"            !L/R Schedule
  163. #Incl    "stdioset.iif"        !standard I/O settings
  164. =Lscl     0             !input  low-value
  165. =Loff     1            !input  high-value
  166. =Llow     0.            !output low-value
  167. =Lhgh     1.            !output high-value
  168. @SVsl                !save the super layer back
  169. !
  170. =n5    0.0
  171. =n6    1.0
  172. =n4    &Out
  173. #Incl    "stdprobe.iif"        !Standard probe include file
  174. !
  175. =LrnN    10000            !Learn N Value
  176. =jogl     0.0            !lower limit for jog
  177. =jogh    +1.0            !upper limit for jog
  178. =seed    253            !starting seed number
  179. @seed                !set the seed
  180. @Nini                !Initialize the network
  181. @EOF
  182.  
  183.