home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 3 / PDCD_3.iso / pocketbk / utilsr / spydrx / HEBB.WEB < prev    next >
Text File  |  1995-08-20  |  5KB  |  178 lines

  1.  
  2. <opts>
  3. <odest>screen</odest>
  4. <oname>OUTPUT</oname>
  5. <onewl>lf</onewl>
  6. <cfmt></cfmt>
  7. <ctype>iterate</ctype>
  8. <citer>1</citer>
  9. <call>no</call>
  10. <cdisp>list</cdisp>
  11. <cext>no</cext>
  12. <rfmt>\n\N:=\F</rfmt>
  13. <rall>yes</rall>
  14. <starg></starg>
  15. <srpl></srpl>
  16. <scount>1</scount>
  17. <sout>yes</sout>
  18. <nfmt>fixed</nfmt>
  19. <ndec>2</ndec>
  20. <nang>degrees</nang></opts>
  21. <cell>
  22. <cname>a1</cname>
  23. <val>-10</val></cell>
  24. <cell>
  25. <cname>a2</cname>
  26. <val>-5</val></cell>
  27. <cell>
  28. <cname>a3</cname>
  29. <val>5</val></cell>
  30. <cell>
  31. <cname>a4</cname>
  32. <val>10</val></cell>
  33. <cell>
  34. <cname>A_Faster_Way</cname>
  35. <text>
  36. The recipie in the home cell (steps a  through g) works for large values of k, but it requires you to repeatedly select the first calc list, evaluate, select the second calc list, evaluate, and so on.  We can get around this inconvenience by changing the output vector component formulae, (bj's) to:
  37.  
  38. 2)        bj=a1*w1j!+a2*w2j!+a3*w3j!+a4*w4j!      j=1..4
  39.  
  40. The exclamation points cause the weights to be recalculated first (propagate override on evaluation rule) before the previous values of the aj's are substituted into the formulae.
  41.  
  42. With this change it is possible to to teach the pattern asociation in one iterative calculation.  Set the iterations to 10 or 20, or whatever it takes, and execute the calc list:
  43.  
  44.                           b1,b2,b3,b4
  45.  
  46.  
  47. </text></cell>
  48. <cell>
  49. <cname>b1</cname>
  50. <val>10.02</val>
  51. <form>a1*w11+a2*w21+a3*w31+a4*w41</form></cell>
  52. <cell>
  53. <cname>b2</cname>
  54. <val>0.00</val>
  55. <form>a1*w12+a2*w22+a3*w32+a4*w42</form></cell>
  56. <cell>
  57. <cname>b3</cname>
  58. <val>-10.02</val>
  59. <form>a1*w13+a2*w23+a3*w33+a4*w43</form></cell>
  60. <cell>
  61. <cname>b4</cname>
  62. <val>0.00</val>
  63. <form>a1*w14+a2*w24+a3*w34+a4*w44</form></cell>
  64. <cell>
  65. <cname>home</cname>
  66. <text>This web illustrates Hebbian learning and the use of a delta rule for pattern association between two four element vectors A and B, using an interconnection matrix W.
  67.  
  68.    a1       a2       a3       a4
  69. w11   w12    w13    w15    b1
  70. w21   w22    w23    w24    b2
  71. w31   w32    w33    w34    b3
  72. w41   w42    w43    w44    b4
  73.  
  74. For any collection of weights (wij's) and inputs (aj's), a collection of outputs (bj's) may be computed according to the formula:
  75.  
  76.     1)    bj=a1*w1j+a2*w2j+a3*w3j+a4*w4j,   j=1..4
  77.  
  78. For a given input vector A, it is possible to 'teach' the associator to produce a particular output vector, (the target vectorT ) in the following way:
  79.  
  80.     a) Set the values aj of the input vector A
  81.     b) Set the values ti of the target vector T
  82.     c)  Set the values of the weights wij to random or
  83.          the similar small values.
  84.     d) Set the formulae of the weights to the expression:
  85.  
  86.                 wij=wij+ai*(tj-bj)/k         ( delta rule)
  87.  
  88.     e) Compute a trial set of output values using equation 1).  The formulae in bj will accomplish this task if you set the Calc preference "Recalc All Cells?" to No, and select and evaluate the cell name list:
  89.  
  90.          b1,b2,b3,b4
  91.  
  92. f)  Then recompute the weights wij by selecting and evaluating the  list:
  93.  
  94.           w11,w12,w13,w14,w21,w22,w23,w24,w31,w32,w33,
  95.          w34,w41,w42,w43,w44
  96.  
  97. g)  Repet steps e) and f) until the output vector B is as close to the target vector T as you desire.
  98.  
  99. For a way to accomplish this in one step, go to the cell called   &A_Faster_Way</text></cell>
  100. <cell>
  101. <cname>k</cname>
  102. <val>1000</val></cell>
  103. <cell>
  104. <cname>t1</cname>
  105. <val>10</val></cell>
  106. <cell>
  107. <cname>t2</cname>
  108. <val>0</val></cell>
  109. <cell>
  110. <cname>t3</cname>
  111. <val>-10</val></cell>
  112. <cell>
  113. <cname>t4</cname>
  114. <val>0</val></cell>
  115. <cell>
  116. <cname>w11</cname>
  117. <val>-0.40</val>
  118. <form>w11+a1*(t1-b1)/k</form></cell>
  119. <cell>
  120. <cname>w12</cname>
  121. <val>0.00</val>
  122. <form>w12+a1*(t2-b2)/k</form></cell>
  123. <cell>
  124. <cname>w13</cname>
  125. <val>0.40</val>
  126. <form>w13+a1*(t3-b3)/k</form></cell>
  127. <cell>
  128. <cname>w14</cname>
  129. <val>0.00</val>
  130. <form>w14+a1*(t4-b4)/k</form></cell>
  131. <cell>
  132. <cname>w21</cname>
  133. <val>-0.20</val>
  134. <form>w21+a2*(t1-b1)/k</form></cell>
  135. <cell>
  136. <cname>w22</cname>
  137. <val>0.00</val>
  138. <form>w22+a2*(t2-b2)/k</form></cell>
  139. <cell>
  140. <cname>w23</cname>
  141. <val>0.20</val>
  142. <form>w23+a2*(t3-b3)/k</form></cell>
  143. <cell>
  144. <cname>w24</cname>
  145. <val>0.00</val>
  146. <form>w24+a2*(t4-b4)/k</form></cell>
  147. <cell>
  148. <cname>w31</cname>
  149. <val>0.20</val>
  150. <form>w31+a3*(t1-b1)/k</form></cell>
  151. <cell>
  152. <cname>w32</cname>
  153. <val>0.00</val>
  154. <form>w32+a3*(t2-b2)/k</form></cell>
  155. <cell>
  156. <cname>w33</cname>
  157. <val>-0.20</val>
  158. <form>w33+a3*(t3-b3)/k</form></cell>
  159. <cell>
  160. <cname>w34</cname>
  161. <val>0.00</val>
  162. <form>w34+a3*(t4-b4)/k</form></cell>
  163. <cell>
  164. <cname>w41</cname>
  165. <val>0.40</val>
  166. <form>w41+a4*(t1-b1)/k</form></cell>
  167. <cell>
  168. <cname>w42</cname>
  169. <val>0.00</val>
  170. <form>w42+a4*(t2-b2)/k</form></cell>
  171. <cell>
  172. <cname>w43</cname>
  173. <val>-0.40</val>
  174. <form>w43+a4*(t3-b3)/k</form></cell>
  175. <cell>
  176. <cname>w44</cname>
  177. <val>0.00</val>
  178. <form>w44+a4*(t4-b4)/k</form></cell></eof>