home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sources / misc / 3878 < prev    next >
Encoding:
Text File  |  1992-09-02  |  50.6 KB  |  1,164 lines

  1. Newsgroups: comp.sources.misc
  2. Path: sparky!kent
  3. From: drt@chinet.chi.il.us (Donald Tveter)
  4. Subject:  v31i129:  backprop - Fast Backpropagation, Part01/04
  5. Message-ID: <csm-v31i129=backprop.130027@sparky.IMD.Sterling.COM>
  6. Followup-To: comp.sources.d
  7. X-Md4-Signature: 412f11eddccad5739dd0a89dffa28abf
  8. Sender: kent@sparky.imd.sterling.com (Kent Landfield)
  9. Organization: Sterling Software
  10. Date: Wed, 2 Sep 1992 18:06:40 GMT
  11. Approved: kent@sparky.imd.sterling.com
  12. Lines: 1150
  13.  
  14. Submitted-by: drt@chinet.chi.il.us (Donald Tveter)
  15. Posting-number: Volume 31, Issue 129
  16. Archive-name: backprop/part01
  17. Supersedes: backprop: Volume 28, Issue 63-66
  18. Environment: UNIX, DOS
  19.  
  20.    The programs described below were produced for my own use in studying
  21. back-propagation and for doing some examples that are found in my
  22. introduction to Artificial Intelligence textbook, The Basis of
  23. Artificial Intelligence, to be published by Computer Science Press.  (I
  24. hope some time before the sun burns out or before the Cubs win the World
  25. Series or before Congress balances the budget or ...  .) I have
  26. copyrighted these files but I hereby give permission to anyone to use
  27. them for experimentation, educational purposes or to redistribute them
  28. on a not for profit basis.  All others that want to use these programs
  29. for business or commercial purposes I will charge you a small fee.  You
  30. should contact me by mail at the address in the readme.
  31.  
  32. Changes/Additions vs. the February 1992 Version
  33.  
  34.    The programs now have the quickprop algorithm included with a few
  35. experimental modifications of this algorithm as well.
  36.  
  37. Also I would be interested in hearing from anyone with suggestions,
  38. bug reports and major successes or failures.  (Caution though:  email
  39. in and out of the whole Chicago area is often unreliable.  Also from
  40. time to time I get email and reply but the reply bounces.  If its
  41. really important include a physical mail address.)
  42.  
  43.    There are four simulators that can be constructed from the included
  44. files.  The program, rbp, does back-propagation using real weights and
  45. arithmetic.  The program, bp, does back-propagation using 16-bit integer
  46. weights, 16 and 32-bit integer arithmetic and some floating point
  47. arithmetic.  The program, sbp, uses 16-bit integer symmetric weights but
  48. only allows two-layer networks.  The program srbp does the same using
  49. real weights.  The purpose of sbp and srbp is to produce networks that
  50. can be used with the Boltzman machine relaxation algorithm (not
  51. included).
  52.  
  53.    In general the 16-bit integer programs are the most useful because
  54. they are the fastest.  Unfortunately, sometimes 16-bit integer weights
  55. don't have enough range or precision and then using the floating point
  56. versions may be necessary.  Many other speed-up techniques are included
  57. in these programs.
  58.  
  59. See the file readme for more information.
  60.  
  61. Dr. Donald R. Tveter
  62. 5228 N. Nashville Ave.
  63. Chicago, Illinois   60656
  64. USENET:  drt@chinet.chi.il.us
  65. ------
  66. #! /bin/sh
  67. # This is a shell archive.  Remove anything before this line, then unpack
  68. # it by saving it into a file and typing "sh file".  To overwrite existing
  69. # files, type "sh file -c".  You can also feed this as standard input via
  70. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  71. # will see the following message at the end:
  72. #        "End of archive 1 (of 4)."
  73. # Contents:  readme
  74. # Wrapped by drt@chinet on Mon Aug 24 08:57:28 1992
  75. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  76. if test -f 'readme' -a "${1}" != "-c" ; then 
  77.   echo shar: Will not clobber existing file \"'readme'\"
  78. else
  79. echo shar: Extracting \"'readme'\" \(46585 characters\)
  80. sed "s/^X//" >'readme' <<'END_OF_FILE'
  81. XFast Back-Propagation
  82. XCopyright (c) 1990, 1991, 1992 by Donald R. Tveter
  83. X
  84. X
  85. X1. Introduction
  86. X
  87. X   The programs described below were produced for my own use in studying
  88. Xback-propagation and for doing some examples that are found in my
  89. Xintroduction to Artificial Intelligence textbook, The Basis of
  90. XArtificial Intelligence, to be published by Computer Science Press.  (I
  91. Xhope some time before the sun burns out or before the Cubs win the World
  92. XSeries or before Congress balances the budget or ...  .) I have
  93. Xcopyrighted these files but I hereby give permission to anyone to use
  94. Xthem for experimentation, educational purposes or to redistribute them
  95. Xon a not for profit basis.  All others that want to use these programs
  96. Xfor business or commercial purposes I will charge you a small fee.  You
  97. Xshould contact me by mail at:
  98. X
  99. XDr. Donald R. Tveter
  100. X5228 N. Nashville Ave.
  101. XChicago, Illinois   60656
  102. XUSENET:  drt@chinet.chi.il.us
  103. X
  104. XAlso I would be interested in hearing from anyone with suggestions,
  105. Xbug reports and major successes or failures.  (Caution though:  email
  106. Xin and out of the whole Chicago area is often unreliable.  Also from
  107. Xtime to time I get email and reply but the reply bounces.  If its
  108. Xreally important include a physical mail address.)
  109. X
  110. X   Note:  this is use at your own risk software:  there is no guarantee
  111. Xthat it is bug-free.  Use of this software constitutes acceptance for
  112. Xuse in an as is condition.  There are no warranties with regard to this
  113. Xsoftware. In no event shall the author be liable for any damages
  114. Xwhatsoever arising out of or in connection with the use or performance
  115. Xof this software.
  116. X
  117. X   There are four simulators that can be constructed from the included
  118. Xfiles.  The program, rbp, does back-propagation using real weights and
  119. Xarithmetic.  The program, bp, does back-propagation using 16-bit integer
  120. Xweights, 16 and 32-bit integer arithmetic and some floating point
  121. Xarithmetic.  The program, sbp, uses 16-bit integer symmetric weights but
  122. Xonly allows two-layer networks.  The program srbp does the same using
  123. Xreal weights.  The purpose of sbp and srbp is to produce networks that
  124. Xcan be used with the Boltzman machine relaxation algorithm (not
  125. Xincluded).
  126. X
  127. X   In general the 16-bit integer programs are the most useful because
  128. Xthey are the fastest.  Unfortunately, sometimes 16-bit integer weights
  129. Xdon't have enough range or precision and then using the floating point
  130. Xversions may be necessary.  Many other speed-up techniques are included
  131. Xin these programs.
  132. X
  133. XChanges/Additions vs. the February 1992 Version
  134. X
  135. X   The programs now have the quickprop algorithm included with a few
  136. Xexperimental modifications of this algorithm as well.
  137. X
  138. X2. Making the Simulators
  139. X
  140. X   See the file, readme.mak.  (This file is getting too large for some
  141. Xmailers.)
  142. X
  143. X3. A Simple Example
  144. X
  145. X  Each version would normally be called with the name of a file to read
  146. Xcommands from, as in:
  147. X
  148. Xbp xor
  149. X
  150. XWhen no file name is specified bp will take commands from the keyboard
  151. X(UNIX stdin file).  After the data file is read commands are then taken
  152. Xfrom the keyboard.
  153. X
  154. X   The commands are one letter commands and most of them have optional
  155. Xparameters.  The `A', `B', `d' and `f' commands allow a number of
  156. Xsub-commands on a line.  The maximum length of any line is 256
  157. Xcharacters.  An `*' is a comment and it can be used to make the
  158. Xremainder of the line a comment.  Here is an example of a data file to
  159. Xdo the xor problem:
  160. X           
  161. X* input file for the xor problem
  162. X           
  163. Xm 2 1 1           * make a 2-1-1 network
  164. Xc 1 1 3 1         * add this extra connection
  165. Xc 1 2 3 1         * add this extra connection
  166. Xs 7               * seed the random number function
  167. Xk 0 1             * give the network random weights
  168. X
  169. Xn 4               * read four new patterns into memory
  170. X1 0 1
  171. X0 0 0
  172. X0 1 1
  173. X1 1 0
  174. X
  175. Xe 0.5             * set eta to 0.5 (and eta2 to 0.5)
  176. Xa 0.9             * set alpha to 0.9
  177. X
  178. XFirst in this example, the m command will make a network with 2 units
  179. Xin the input layer, 1 unit in the second layer and 1 unit in the third
  180. Xlayer.  The following c commands create extra connections from layer 1
  181. Xunit 1 to layer 3 unit 1 and from layer 1 unit 2 to layer 3 unit 1.  The
  182. X`s' command sets the seed for the random number function.  The `k'
  183. Xcommand then gives the network random weights.  The `k' command has
  184. Xanother use as well.  It can be used to try to kick a network out of a
  185. Xlocal minimum.  Here, the meaning of "k 0 1" is to examine all the
  186. Xweights in the network and for every weight equal to 0 (and they all
  187. Xstart out at 0), add in a random number between -1 and +1.  The `n'
  188. Xcommand specifies four new patterns to be read into memory.  With the
  189. X`n' command, any old patterns that may have been present are removed.
  190. XThere is also an `x' command that behaves like the `n' command, except
  191. Xthe `x' commands ADDS the extra patterns to the current training
  192. Xset.  The input pattern comes first followed by the output pattern.
  193. XThe statement, e 0.5, sets eta, the learning rate for the upper layer to
  194. X0.5 and eta2 for the lower layers to 0.5 as well.  The last line sets
  195. Xalpha, the momentum parameter, to 0.9.
  196. X
  197. X   After these commands are executed the following messages and prompt
  198. Xappears:
  199. X
  200. XFast Back-Propagation Copyright (c) 1990, 1991, 1992 by Donald R. Tveter
  201. Xtaking commands from stdin now
  202. X[?!*AaBbCcdefHhiklmnOoPpQqRrSstWwx]?
  203. X
  204. XThe characters within the square brackets are a list of the possible
  205. Xcommands.  To run 100 iterations of back-propagation and print out the
  206. Xstatus of the learning every 20 iterations type "r 100 20" at the
  207. Xprompt:
  208. X
  209. X[?!*AaBbCcdefHhiklmnOoPpQqRrSstWwx]? r 100 20
  210. X
  211. XThis gives:
  212. Xrunning . . .
  213. X   20 iterations    0.00% right (0 right   4 wrong)   0.49927 error/unit
  214. X   40 iterations    0.00% right (0 right   4 wrong)   0.43188 error/unit
  215. X   60 iterations   75.00% right (3 right   1 wrong)   0.09033 error/unit
  216. X   62 iterations  100.00% right (4 right   0 wrong)   0.07129 error/unit
  217. Xpatterns learned to within 0.10 at iteration^G 62
  218. X
  219. XThe program immediately prints out the "running . . ." message.  After
  220. Xeach 20 iterations a summary of the learning process is printed giving
  221. Xthe percentage of patterns that are right, the number right and wrong
  222. Xand the average value of the absolute values of the errors of the output
  223. Xunits.  The program stops when the each output for each pattern has been
  224. Xlearned to within the required tolerance, in this case the default value
  225. Xof 0.1.  A ctrl-G is normally printed out as well to sound the bell.  If
  226. Xthe second number defining how often to print out a summary is omitted
  227. Xthe summaries will not be printed.  Sometimes the integer versions will
  228. Xdo a few extra iterations before declaring the problem done because of
  229. Xtruncation errors in the arithmetic done to check for convergence.  The
  230. Xstatus figures for iteration i are computed when making the forward pass
  231. Xof the iteration and before the weights are updated so these values are
  232. Xone iteration out of date.  This saves on CPU time, however, if you
  233. Xreally need up-do-date statistics use the u+ option described in the
  234. Xformat specifications.
  235. X
  236. XListing Patterns
  237. X
  238. X   To get a listing of the status of each pattern use the `P' command
  239. Xto give:
  240. X
  241. X[?!*AaBbCcdefHhiklmnOoPpQqRrSstWwx]? P
  242. X  1  0.90  (0.098) ok
  243. X  2  0.05  (0.052) ok
  244. X  3  0.94  (0.062) ok
  245. X  4  0.07  (0.074) ok
  246. X   62 iterations  100.00% right (4 right   0 wrong)   0.07129 error/unit
  247. X
  248. XThe numbers in parentheses give the sum of the absolute values of the
  249. Xoutput errors for each pattern.  An `ok' is given to every pattern that
  250. Xhas been learned to within the required tolerance.  To get the status of
  251. Xone pattern, say, the fourth pattern, type "P 4" to give:
  252. X
  253. X 0.07  (0.074) ok
  254. X
  255. XTo get a summary without the complete listing use "P 0".  To get the
  256. Xoutput targets for a given pattern, say pattern 3, use "O 3".
  257. X
  258. X   A particular test pattern can be input to the network with the `p'
  259. Xcommand, as in:
  260. X
  261. X[?!*AaBbCcdefHhiklmnOoPpQqRrSstWwx]? p 1 0
  262. X 0.90 
  263. X
  264. XExamining Weights
  265. X
  266. X   It is often interesting to see the values of some particular weights
  267. Xin the network.  To see a listing of all the weights in a network use
  268. Xthe save weights command described below and then cat the file weights,
  269. Xhowever, to see the weights leading into a particular node, say the node
  270. Xin row 2, node 1 use the w command as in:
  271. X
  272. X[?!*AaBbCcdefHhiklmnOoPpQqRrSstWwx]? w 2 1
  273. Xlayer unit  unit value     weight         input from unit
  274. X  1      1    1.00000     9.53516             9.53516
  275. X  1      2    0.00000    -8.40332             0.00000
  276. X  2      t    1.00000     4.13086             4.13086
  277. X                                      sum =  13.66602
  278. X
  279. XThis listing also gives data on how the current activation value of the
  280. Xnode is computed using the weights and the activations values of the
  281. Xnodes feeding into unit 1 of layer 2.  The `t' unit is the threshold
  282. Xunit.
  283. X
  284. XThe Help Command
  285. X
  286. X   To get a short description of any command, type `h' followed by the
  287. Xletter of the command.  Here, we type h h for help with help:
  288. X
  289. X[?!*AaBbCcdefHhiklmnOoPpQqRrSstWwx]? h h
  290. X
  291. Xh <letter> gives help for command <letter>.
  292. X
  293. XTo list the status of all the parameters in the program, use `?'.
  294. X
  295. XTo Quit the Program
  296. X
  297. X   Finally, to end the program, the `q' (for quit) command is entered:
  298. X
  299. X[?!*AaBbCcdefHhiklmnOoPpQqRrSstWwx]? q
  300. X
  301. X
  302. X4. The Format Command
  303. X
  304. X   There are several ways to input and output patterns, numbers and
  305. Xother values and there is one format command, `f', that is used to set
  306. Xthese options.  In the format command a number of options can be
  307. Xspecified on a single line as for example in:
  308. X
  309. Xf b+ ir oc s- wB
  310. X
  311. XInput Patterns
  312. X
  313. X   The programs are able to read pattern values in two different
  314. Xformats.  The default input format is the compressed format.  In it,
  315. Xeach value is one character and it is not necessary to have blanks
  316. Xbetween the characters.  For example, in compressed format the patterns
  317. Xfor xor could be written out in either of the following ways:
  318. X
  319. X101      10 1
  320. X000      00 0
  321. X011      01 1
  322. X110      11 0
  323. X
  324. XThe second example is preferable because it makes it easier to see the
  325. Xinput and the output patterns.  Compressed format can also be used to
  326. Xinput patterns with the `p' command.  In addition to using 1 and 0 as
  327. Xinput the character, `?' can be used.  This character is initially
  328. Xdefined to be 0.5, but it can be redefined using the Q command like so:
  329. X
  330. XQ -1
  331. X
  332. XThis sets the value of ?  to -1.  Other valid input characters are the
  333. Xletters, `h', `i', `j' and `k'.  The `h' stands for `hidden'.  Its
  334. Xmeaning in an input string is that the value at this point in the string
  335. Xshould be taken from the next unit in the second layer of the network.
  336. XThis notation is useful for specifying simple recurrent networks.
  337. XNaturally, `i', `j' and `k' stand for taking input values from the
  338. Xthird, fourth and fifth layers (if they exist).  A simple example of a
  339. Xrecurrent network is given later.
  340. X
  341. X   The other input format for numbers is real.  The number portion must
  342. Xstart with a digit (.35 is not allowed, but 0.35 is).  Exponential
  343. Xnotation is not allowed.  Real numbers have to be separated by a space.
  344. XThe `h', `i', `j', `k' and `?' characters are also allowed with real
  345. Xinput patterns.  To take input in the real format it is necessary to
  346. Xset the input format to be real using the `f' (format) command as in:
  347. X
  348. Xf ir
  349. X
  350. XTo change back to the compressed format use:
  351. X
  352. Xf ic
  353. X
  354. XOutput of Patterns
  355. X
  356. X   Output format is controlled with the `f' command as in:
  357. X
  358. Xf or
  359. Xf oc
  360. Xf oa
  361. X
  362. XThe first sets the output to real numbers.  The second sets the output
  363. Xto be compressed mode where the value printed will be a `1' when the
  364. Xunit value is greater than 1.0 - tolerance, a `^' when the value is
  365. Xabove 0.5 but less than 1.0 - tolerance, a `v' when the value is less
  366. Xthan 0.5 but greater than the tolerance.  Below the tolerance value a
  367. X`0' is printed.  The tolerance can be changed using the `t' command (not
  368. Xa part of the format command).  For example, to make all values greater
  369. Xthan 0.8 print as `1' and all values less than 0.2 print as `0' use:
  370. X
  371. Xt 0.2
  372. X
  373. XOf course this same tolerance value is also used to check to see if all
  374. Xthe patterns have converged.  The third output format is meant to give
  375. X"analog compressed" output.  In this format a `c' is printed when a
  376. Xvalue is close enough to its target value.  Otherwise, if the answer is
  377. Xclose to 1, a `1' is printed, if the answer is close to 0, a `0' is
  378. Xprinted, if the answer is above the target but not close to 1, a `^' is
  379. Xprinted and if the answer is below the target but not close to 0, a `v'
  380. Xis printed.  This output format is designed for problems where the
  381. Xoutput is a real number, as for instance, when the problem is to make a
  382. Xnetwork learn sin(x).
  383. X
  384. X   For the sake of convenience the output format (and only the output
  385. Xformat) can be set without using the `f' so that:
  386. X
  387. Xor
  388. X
  389. Xwill also make the output format real.
  390. X
  391. XBreaking up the Output Values
  392. X
  393. X   In the compressed formats the default is to print a blank after
  394. Xevery 10 values.  This can be altered using the `b' (for inserting
  395. Xbreaks) command.  The use for this command is to separate output values
  396. Xinto logical groups to make the output more readable.  For instance, you
  397. Xmay have 24 output units where it makes sense to insert blanks after the
  398. X4th, 7th and 19th positions.  To do this, specify:
  399. X
  400. Xb 4 7 19
  401. X
  402. XThen for example the output will look like:
  403. X
  404. X  1 10^0 10^ ^000v00000v0 01000 (0.17577)
  405. X  2 1010 01v 0^0000v00000 ^1000 (0.16341)
  406. X  3 0101 10^ 00^00v00000v 00001 (0.16887)
  407. X  4 0100 0^0 000^00000v00 00^00 (0.19880)
  408. X
  409. XThe `b' command allows up to 20 break positions to be specified.  The
  410. Xdefault output format is the real format with 10 numbers per line.  For
  411. Xthe output of real values the `b' command specifies when to print a
  412. Xcarriage return rather than when to print a blank.  (Note:  the `b'
  413. Xcommand is not part of the `f' command.)
  414. X
  415. XPattern Formats
  416. X
  417. X   There are two different types of problems that back-propagation can
  418. Xhandle, the general type of problem where every output unit can take on
  419. Xan arbitrary value and the classification type of problem where the goal
  420. Xis to turn on output unit i and turn off all the other output units when
  421. Xthe pattern is of class i.  The xor problem is an example of the general
  422. Xtype of problem.  For an example of a classification problem, suppose
  423. Xyou have a number of data points scattered about through two-dimensional
  424. Xspace and you have to classify the points as either class 1, class 2 or
  425. Xclass 3.  For a pattern of class 1 you can always set up the output:
  426. X"1 0 0", for class 2: "0 1 0" and for class 3: "0 0 1", however doing
  427. Xthe translation to bit patterns can be annoying so another notation can
  428. Xbe used.  Instead of specifying the bit patterns you can set the pattern
  429. Xformat option to classification (as opposed to the default value of
  430. Xgeneral) like so:
  431. X
  432. Xf pc
  433. X
  434. Xand then the program will read data in the form:
  435. X
  436. X   1.33   3.61   1   *  shorthand for 1 0 0
  437. X   0.42  -2.30   2   *  shorthand for 0 1 0
  438. X  -0.31   4.30   3   *  shorthand for 0 0 1
  439. X
  440. Xand translate it to the bit string form when the pattern is loaded onto
  441. Xthe output units.  To switch to the general form use "f pg".
  442. X
  443. X   In addition to controlling the input of data the p command within
  444. Xthe format command is used to control the output of patterns from a set
  445. Xof test patterns kept on a file.  If the format is either c or g then
  446. Xwhen the test set is run thru the network you will only get a summary of
  447. Xhow many patterns are correct.  If the format is either C or G you will
  448. Xget a listing of the output values for each pattern as well as the
  449. Xsummary.  When reading patterns, C works the same as c and G works the
  450. Xsame as g.
  451. X
  452. XControlling Summaries
  453. X
  454. X   When the program is learning patterns you can have it print out the
  455. Xstatus of the learning process at regular intervals.  The default is to
  456. Xprint out only a summary of how learning is going however you can also
  457. Xprint out the status of every pattern at regular intervals.  To get the
  458. Xwhole set of patterns use "f s-" to turn off the summary format and "f
  459. Xs+" to go back to summarizing.
  460. X
  461. XRinging the Bell
  462. X
  463. X   To ring the bell when the learning has been completed use "f b+" and
  464. Xto turn off the bell use "f b-".
  465. X
  466. XEchoing Input
  467. X
  468. X   When you are reading commands from a file it is often worthwhile to
  469. Xsee those commands echoed on the screen.  To do this, use "f e+" and to
  470. Xturn off the echoing, use "f e-".
  471. X
  472. XPaging
  473. X
  474. X   The program is set up to write 24 lines to the screen and then pause.
  475. XAt the pause the program prints out a ":" (as does the UNIX System V
  476. Xpager, pg).  At this point typing a carriage return will get you one
  477. Xmore page.  Typing a "q" followed by a carriage return will quit the
  478. Xprocess you're working on and give you another prompt.  So, if you're
  479. Xrunning for example the xor problem and you type, "r 100 1" you will run
  480. X24 iterations through the program, these will print out and then there
  481. Xwill be a pause.  Notice that the program will not be busy computing
  482. Xanything more during the pause.  To reset the number of lines written to
  483. Xthe screen to say, 12, use "f P 12".  Setting the value to 0 will drop
  484. Xthe paging altogether.
  485. X
  486. X   Note that the program will not be paging at all if you take a series
  487. Xof commands from the original data file or some other input file and the
  488. Xoutput produced by these commands is less than the page size.  That is
  489. Xto say, a new line count is started every time a new command is read and
  490. Xif the output of that command is less than the page size there won't be
  491. Xany paging.
  492. X
  493. XMaking a Copy of Your Session
  494. X
  495. X   To make a copy of what appears on the screen use "f c+" to start
  496. Xwriting to the file "copy" and "f c-" to stop writing to this file.
  497. XEnding the session automatically closes this file as well.
  498. X
  499. XUp-To-Date Statistics
  500. X
  501. X   During the ith pass thru the network the program will collect
  502. Xstatistics on how many patterns are correct and how much error there is
  503. Xoverall.  These numbers are gathered before the weights are updated and
  504. Xso the results listed for iteration i really show the situation after
  505. Xthe weight update for iteration i-1.  To complicate matters more the
  506. Xweight updates can be done continuously instead of after all the
  507. Xpatterns have been presented so the statistics you get here are skewed
  508. Xeven more.  If you want to have up-to-date statistics with either
  509. Xmethod use "f u+" and to go back to statistics that are out of date
  510. Xuse "f u-".  The penalty with "f u+" is that the program needs to do
  511. Xanother forward pass.  When using the continuous update method it is
  512. Xhighly advisable to use "f u+" at least when you get close to complete
  513. Xconvergence because the default method of checking may claim the
  514. Xlearning is finished when it isn't or it may continue training after the
  515. Xtolerances have been met.
  516. X
  517. X 5. Taking Training and Testing Patterns from Files
  518. X
  519. X   In the xor example given above the four patterns were part of the
  520. Xdata file and to read them in the following lines were used:
  521. X
  522. Xn 4
  523. X1 0 1
  524. X0 0 0
  525. X0 1 1
  526. X1 1 0
  527. X
  528. XHowever it is also convenient to take patterns from a file that
  529. Xcontains nothing but a list of patterns (and possibly comments).  To
  530. Xread a new set of patterns from some file, patterns, use:
  531. X
  532. Xn f patterns
  533. X
  534. XTo add an extra group of patterns to the current set you can use:
  535. X
  536. Xx f patterns
  537. X
  538. X   In addition to keeping a set of training patterns you can take
  539. Xtesting patterns from a file as well.  To specify the file you can
  540. Xinvoke the program with a second file name as in:
  541. X
  542. Xbp xor xtest
  543. X
  544. XIn addition, if you do the following:
  545. X
  546. Xt f xtest
  547. X
  548. Xthe program will set xtest as the test file and immediately do the
  549. Xtesting.  Once the file has been defined you can test the patterns on
  550. Xthe test file by "t f" or just "t".  (This leaves the t command doing
  551. Xdouble duty since "t <real>" will set the tolerance to <real>.) Also in
  552. Xaddition, the test file can be set without being tested by using
  553. X
  554. XB t f xtest
  555. X
  556. Xas explained in the benchmarking section.
  557. X
  558. X
  559. X6. Saving and Restoring Weights and Related Values
  560. X
  561. X   Sometimes the amount of time and effort needed to produce a set of
  562. Xweights to solve a problem is so great that it is more convenient to
  563. Xsave the weights rather than constantly recalculate them.  Weights can
  564. Xbe saved as real values in an ASCII format (the default) or as binary
  565. Xto save space.  The old way to save the weights (which still works) is
  566. Xto enter the command, "S".  The weights are then written on a file
  567. Xcalled "weights" or to the last file name you have specified, if you're
  568. Xusing the new version of the command.  The following file comes from the
  569. Xxor problem:
  570. X
  571. X62r   file = ../xor3
  572. X    9.5351562500
  573. X   -8.4033203125
  574. X    4.1308593750
  575. X    5.5800781250
  576. X   -4.9755859375
  577. X  -11.3095703125
  578. X    8.0527343750
  579. X
  580. XTo write the weights the program starts with the second layer, writes
  581. Xout the weights leading into these units in order with the threshold
  582. Xweight last, then it moves on to the third layer, and so on.  To
  583. Xrestore these weights type an `R' for restore.  At this time the
  584. Xprogram reads the header line and sets the total number of iterations
  585. Xthe program has gone through to be the first number it finds on the
  586. Xheader line.  It then reads the character immediately after the number.
  587. XThe `r' indicates that the weights will be real numbers represented as
  588. Xcharacter strings.  If the weights were binary the character would be a
  589. X`b' rather than an `r'.  Also, if the character is `b', the next
  590. Xcharacter is read.  This next character indicates how many bytes are
  591. Xused per value.  The integer versions bp and sbp write files with 2
  592. Xbytes per weight while the real versions rbp and srbp write files with
  593. X8 bytes per weight for double precision reals and 4 bytes per weight for
  594. Xsingle precision reals.  With this notation weight files written by one
  595. Xprogram can be read by the other.  A binary weight format is specified
  596. Xwithin the `f' command by using "f wb".  A real format is specified by
  597. Xusing "f wr".  If your program specifies that weights should be written
  598. Xin one format but the weight file you read from is different a notice
  599. Xwill be given.  There is no check made to see if the number of weights
  600. Xon the file equals the number of weights in the network.
  601. X
  602. X   The above formats specify that only weights are written out and this
  603. Xis all you need once the patterns have converged.  However, if you're
  604. Xstill training the network and want to break off training and pick up
  605. Xthe training from exactly the same point later on you need to save the
  606. Xold weight changes when using momentum and the parameters for the
  607. Xdelta-bar-delta method if you are using this technique.  To save these
  608. Xextra parameters on the weights file use "f wR" to write the extra
  609. Xvalues as real and "f wB" to write the extra values as binary.
  610. X
  611. X   In the above example the command, S, was used to save the weights
  612. Ximmediately.  Another alternative is to save weights at regular
  613. Xintervals.  The command, S 100, will automatically save weights every
  614. X100 iterations the program does.  The default rate at which to save
  615. Xweights is set at 32767 for 16-bit compilers and 2147483647 for 32-bit
  616. Xcompilers which generally means that no weights will ever be saved.
  617. X
  618. X   To save weights to a file other than "weights" you can say:
  619. X"s w <filename>", where, of course, <filename> is the file you want to
  620. Xsave to.  To continue saving to the same file you can just do "s w".
  621. XNaturally if you restore weights it will be from this current weights
  622. Xfile as well.  You can restore weights from another file by using:
  623. X"r w <filename>".  Of course this also sets the name of the file to
  624. Xwrite to so if you're not careful you could lose your original weights
  625. Xfile.
  626. X
  627. X7. Initializing Weights and Giving the Network a `Kick'
  628. X
  629. X   All the weights in the network initially start out at 0.  In
  630. Xsymmetric networks then no learning may result because error signals
  631. Xcancel themselves out.  Even in non-symmetric networks the training
  632. Xprocess will usually converge faster if the weights start out at small
  633. Xrandom values.  To do this the `k' command will take the network and
  634. Xalter the weights in the following ways.  Suppose the command given is:
  635. X
  636. Xk 0 0.5
  637. X
  638. XNow if a weight is exactly 0, then the weight will be changed to a
  639. Xrandom value between +0.5 and -0.5.  The above command can therefore be
  640. Xused to initialize the weights in the network.  A more complex use of
  641. Xthe `k' command is to decrease the magnitude of large weights in the
  642. Xnetwork by a certain random amount.  For instance in the following
  643. Xcommand:
  644. X
  645. Xk 2 8
  646. X
  647. Xall the weights in the network that are greater than or equal to 2 will
  648. Xbe decreased by a random number between 0 and 8.  Weights less than or
  649. Xequal to -2 will be increased by a random number between 0 and 8.  The
  650. Xseed to the random number generator can be changed using the `s' command
  651. Xas in "s 7".  The integer parameter in the `s' command is of type,
  652. Xunsigned.
  653. X
  654. X   Another method of giving a network a kick is to add hidden layer
  655. Xunits.  The command:
  656. X
  657. XH 2 0.5
  658. X
  659. Xadds one unit to layer 2 of the network and all the weights that are
  660. Xcreated are initialized to between - 0.5 and + 0.5.
  661. X
  662. X   The subject of kicking a back-propagation network out of local minima
  663. Xhas barely been studied and there is no guarantee that the above methods
  664. Xare very useful in general.
  665. X
  666. X8. Setting the Algorithm to Use
  667. X
  668. X   A number of different variations on the original back-propagation
  669. Xalgorithm have been proposed in order to speed up convergence and some
  670. Xof these have been built into these simulators.  These options are set
  671. Xusing the `A' command and a number of options can go on the one line.
  672. X
  673. XActivation Functions
  674. X
  675. X   To set the activation function use:
  676. X
  677. XA al * for the linear activation function
  678. XA ap * for the piece-wise activation function
  679. XA as * for the smooth activation function
  680. XA at * for the piecewise near-tanh function that runs from -1 to +1
  681. XA aT * for the continuous near-tanh function that runs from -1 to +1
  682. X
  683. XWhen using the linear activation function it is only appropriate to use
  684. Xthe differential step-size derivative and a two-layer network.  The
  685. Xsmooth activation function is:
  686. X
  687. Xf = 1.0 / (1.0 + exp(-x))
  688. X
  689. Xwhere x is the input to a unit.  The piece-wise function is an
  690. Xapproximation to the function, f and it will normally save some CPU
  691. Xtime even though it may increase the number of iterations you need to
  692. Xsolve the problem.  The continuous near-tanh function is 2f - 1 and the
  693. Xpiece-wise version approximates this function with a series of straight
  694. Xlines.
  695. X
  696. XSharpness (or Gain)
  697. X
  698. X   The sharpness (or gain) is the parameter, D, in the function:
  699. X
  700. X1.0 / (1.0 + exp(-D*x)).
  701. X
  702. XA sharper sigmoid shaped activation function (larger D) will produce
  703. Xfaster convergence (see "Speeding Up Back Propagation" by Yoshio Izui
  704. Xand Alex Pentland in the Proceedings of IJCNN-90-WASH-DC, Lawrence
  705. XErlbaum Associates, 1990).  To set this parameter to say, 8, use
  706. X"A D 8".  The default value is 1.  Unfortunately, too large a value
  707. Xfor D will hurt convergence so this is not a perfect solution to
  708. Xspeeding up learning.  Sometimes the best value for D may be less than
  709. X1.0.  A larger D is also useful in the integer version of
  710. Xback-propagation where the weights are limited to between -32 and
  711. X+31.999.  A larger D value in effect magnifies the weights and makes it
  712. Xpossible for the weights to stay smaller.  Values of D less than one may
  713. Xbe useful in extracting a network from a local minima (see "Handwritten
  714. XNumeral Recognition by Multi-layered Neural Network with Improved
  715. XLearning Algorithm" by Yamada, Kami, Temma and Tsukumo in Proceedings of
  716. Xthe 1989 IJCNN, IEEE Press).  A smaller value of D will also force the
  717. Xweights and the weight changes to be larger and this may be of value
  718. Xwhen the weight changes become less than the weight resolution of 0.001
  719. Xin the integer version.
  720. X
  721. XThe Derivatives
  722. X
  723. X   The correct derivative for the standard activation function is s(1-s)
  724. Xwhere s is the activation value of a unit however when s is near 0 or 1
  725. Xthis term will give only very small weight changes during the learning
  726. Xprocess.  To counter this problem Fahlman proposed the following one
  727. Xfor the output layer:
  728. X
  729. X0.1 + s(1-s)
  730. X
  731. X(For the original description of this method see "Faster Learning
  732. XVariations of Back-Propagation:  An Empirical Study", by Scott E.
  733. XFahlman, in Proceedings of the 1988 Connectionist Models Summer School,
  734. XMorgan Kaufmann, 1989.)  Besides Fahlman's derivative and the original
  735. Xone the differential step size method (see "Stepsize Variation Methods
  736. Xfor Accelerating the Back-Propagation Algorithm", by Chen and Mars, in
  737. XIJCNN-90-WASH-DC, Lawrence Erlbaum, 1990) takes the derivative to be 1
  738. Xin the layer going into the output units and uses the correct derivative
  739. Xterm for all other layers.  The learning rate for the inner layers is
  740. Xnormally set to some smaller value.  To set a value for eta2 give two
  741. Xvalues in the `e' command as in:
  742. X
  743. Xe 0.1 0.01
  744. X
  745. XTo set the derivative use the `A' command as in:
  746. X
  747. XA dd   * use the differential step size derivative (default)
  748. XA dF   * use Fahlman's derivative in only the output layer
  749. XA df   * use Fahlman's derivative in all layers
  750. XA do   * use the original, correct derivative
  751. X
  752. XUpdate Methods
  753. X
  754. X   The choices are the periodic (batch) method, the continuous (online)
  755. Xmethod, delta-bar-delta and quickprop.  The following commands set the
  756. Xupdate methods:
  757. X
  758. XA uc   * for the continuous update method
  759. XA ud   * for the delta-bar-delta method
  760. XA up   * for the original periodic update method (default)
  761. XA uq   * for the quickprop algorithm
  762. X
  763. XThe delta-bar-delta method uses a number of special parameters and these
  764. Xare set using the `d' command.  Delta-bar-delta can be used with any of
  765. Xthe derivatives and the algorithm will find its own value of eta for
  766. Xeach weight.
  767. X
  768. XOther Algorithm Options
  769. X
  770. X   The `b' command controls whether or not to backpropagate error for
  771. Xunits that have learned their response to within a given tolerance.  The
  772. Xdefault is to always backpropagate error.  The advantage to not
  773. Xbackpropagating error is that this can save computer time.  This
  774. Xparameter can be set like so:
  775. X
  776. XA b+   * always backpropagate error
  777. XA b-   * don't backpropagate error when close
  778. X
  779. X   The `s' sub-command will set the number of times to skip a pattern
  780. Xwhen the pattern has been learned to within the desired tolerance.  To
  781. Xskip 3 iterations, use "A s 3", to reset to not skip any patterns
  782. Xuse "A s 0".
  783. X
  784. X   The `t' sub-command will take the given pattern (only one at a
  785. Xtime) out of the training set so that you can then train the other
  786. Xpatterns and test the network's response to this one pattern that was
  787. Xremoved.  To test pattern 3 use "A t 3" and to reset to use all the
  788. Xpatterns use "A t 0".
  789. X
  790. X
  791. X9. The Delta-Bar-Delta Method
  792. X
  793. X   The delta-bar-delta method attempts to find a learning rate, eta, for
  794. Xeach individual weight.  The parameters are the initial value for the
  795. Xetas, the amount by which to increase an eta that seems to be too small,
  796. Xthe rate at which to decrease an eta that is too large, a maximum value
  797. Xfor each eta and a parameter used in keeping a running average of the
  798. Xslopes.  Here are examples of setting these parameters:
  799. X
  800. Xd d 0.5    * sets the decay rate to 0.5
  801. Xd e 0.1    * sets the initial etas to 0.1
  802. Xd k 0.25   * sets the amount to increase etas by (kappa) to 0.25
  803. Xd m 10     * sets the maximum eta to 10
  804. Xd n 0.005  * an experimental noise parameter
  805. Xd t 0.7    * sets the history parameter, theta, to 0.7
  806. X
  807. XThese settings can all be placed on one line:
  808. X
  809. Xd d 0.5  e 0.1  k 0.25  m 10  t 0.7
  810. X
  811. XThe version implemented here does not use momentum.  The symmetric
  812. Xversions sbp and srbp do not implement delta-bar-delta.
  813. X
  814. X   The idea behind the delta-bar-delta method is to let the program find
  815. Xits own learning rate for each weight.  The `e' sub-command sets the
  816. Xinitial value for each of these learning rates.  When the program sees
  817. Xthat the slope of the error surface averages out to be in the same
  818. Xdirection for several iterations for a particular weight the program
  819. Xincreases the eta value by an amount, kappa, given by the `k' parameter.
  820. XThe network will then move down this slope faster.  When the program
  821. Xfinds the slope changes signs the assumption is that the program has
  822. Xstepped over to the other side of the minimum and so it cuts down the
  823. Xlearning rate by the decay factor given by the `d' parameter.  For
  824. Xinstance, a d value of 0.5 cuts the learning rate for the weight in
  825. Xhalf.  The `m' parameter specifies the maximum allowable value for an
  826. Xeta.  The `t' parameter (theta) is used to compute a running average of
  827. Xthe slope of the weight and must be in the range 0 <= t < 1.  The
  828. Xrunning average at iteration i, a[i], is defined as:
  829. X
  830. Xa[i] = (1 - t) * slope[i] + t * a[i-1],
  831. X
  832. Xso small values for t make the most recent slope more important than the
  833. Xprevious average of the slope.  Determining the learning rate for
  834. Xback-propagation automatically is, of course, very desirable and this
  835. Xmethod often speeds up convergence by quite a lot.  Unfortunately, bad
  836. Xchoices for the delta-bar-delta parameters give bad results and a lot of
  837. Xexperimentation may be necessary.  If you have n patterns in the
  838. Xtraining set try starting e and k around 1/n.  The n parameter is an
  839. Xexperimental noise term that is only used in the integer version.  It
  840. Xchanges a weight in the wrong direction by the amount indicated when the
  841. Xprevious weight change was 0 and the new weight change would be 0 and
  842. Xthe slope is non-zero.  (I found this to be effective in an integer
  843. Xversion of quickprop so I tossed it into delta-bar-delta as well.  If
  844. Xyou find this helps please let me know.)  For more on delta-bar-delta
  845. Xsee "Increased Rates of Convergence" by Robert A. Jacobs, in Neural
  846. XNetworks, Volume 1, Number 4, 1988.
  847. X
  848. X10. Quickprop
  849. X
  850. X    Quickprop (see "Faster-Learning Variations on Back-Propagation: An
  851. XEmpirical Study", by Scott E. Fahlman, in Proceedings of the 1988
  852. XConnectionist Models Summer School", Morgan Kaufmann, 1989.) is similar
  853. Xto delta-bar-delta in that the algorithm attempts to increase the size
  854. Xof a weight change for each weight while the process continues to go
  855. Xdownhill in terms of error.  The main acceleration technique is to make
  856. Xthe next weight change mu times the previous weight change.  Fahlman
  857. Xsuggests mu = 1.75 is generally quite good so this is the initial value
  858. Xfor mu but slightly larger or slightly smaller values are sometimes
  859. Xbetter.  In addition when this is done Fahlman also adds in a value,
  860. Xeta times the current slope, in the traditional backprop fashion.  I had
  861. Xto wonder if this was a good idea so in this code I've included a
  862. Xcapability to add it in or not add it in.  So far it seems to me that
  863. Xsometimes adding in this extra term helps and sometimes it doesn't.  The
  864. Xdefault is to always use the extra term.
  865. X
  866. X   A second key property of quickprop is that when a weight change
  867. Xchanges the slope of the error curve from positive to negative or
  868. Xvice-versa, quickprop attempts to jump to the minimum by assuming the
  869. Xcurve is a parabola.
  870. X
  871. X   A third factor involved in quickprop comes about from the fact that
  872. Xthe weights often grow very large very quickly.  To minimize this
  873. Xproblem there is a decay factor designed to keep the weights small.
  874. XFahlman does not mention a value for this parameter but I usually try
  875. X0.0001 to 0.00001.  I've found that too large a decay factor can stall
  876. Xout the learning process so that if your network isn't learning fast
  877. Xenough or isn't learning at all one possible fix is to decrease the
  878. Xdecay factor.  The small values you need present a problem for the
  879. Xinteger version since the smallest value you can represent is about
  880. X0.001.  To get around this problem the decay value you input should be
  881. X1000 times larger than the value you intend to use.  So to get 0.0001,
  882. Xinput 0.1, to get 0.00001, input 0.01, etc.  The code has been written
  883. Xso that the factor of 1000 is taken into account during the calculations
  884. Xinvolving the decay factor.  To keep the values consistent both the
  885. Xinteger and floating point versions use this convention.  If you use
  886. Xquickprop elsewhere you need to take this factor of 1000 into account.
  887. XThe default value for the decay factor is 0.1 (=0.0001).
  888. X
  889. X   I built in one additional feature for the integer version.  I found
  890. Xthat by adding small amounts of noise the time to convergence can be
  891. Xbrought down and the number of failures can be decreased somewhat.  This
  892. Xseems to be especially true when the weight changes get very small.  The
  893. Xnoise consists of moving uphill in terms of error by a small amount when
  894. Xthe previous weight change was zero.  Good values for the noise seem to
  895. Xbe around 0.005.
  896. X
  897. X   The parameters for quickprop are all set in the `qp' command like
  898. Xso:
  899. X
  900. Xqp d 0.1  * the default decay factor
  901. Xqp e 0.5  * the default value for eta
  902. Xqp m 1.75 * the default value for mu
  903. Xqp n 0    * the default value for noise
  904. Xqp s+     * always include the slope
  905. X
  906. Xor a whole series can go on one line:
  907. X
  908. Xqp d 0.1 e 0.5 m 1.75 n 0 s+
  909. X
  910. X
  911. X11. Recurrent Networks
  912. X
  913. X   Recurrent back-propagation networks take values from higher level
  914. Xunits and use them as activation values for lower level units.  This
  915. Xgives a network a simple kind of short-term memory, possibly a little
  916. Xlike human short-term memory.  For instance, suppose you want a network
  917. Xto memorize the two short sequences, "acb" and "bcd".  In the middle of
  918. Xboth of these sequences is the letter, "c".  In the first case you want
  919. Xa network to take in "a" and output "c", then take in "c" and output
  920. X"b".  In the second case you want a network to take in "b" and output
  921. X"c", then take in "c" and output "d".  To do this a network needs a
  922. Xsimple memory of what came before the "c".
  923. X
  924. X   Let the network be an 7-3-4 network where input units 1-4 and output
  925. Xunits 1-4 stand for the letters a-d.  Furthermore, let there be 3 hidden
  926. Xlayer units.  The hidden units will feed their values back down to the
  927. Xinput units 5-7 where they become input for the next step.  To see why
  928. Xthis works, suppose the patterns have been learned by the network.
  929. XInputting the "a" from the first string produces some random pattern of
  930. Xactivation, p1, on the hidden layer units and "c" on the output units.
  931. XThe pattern p1 is copied down to units 5-7 of the input layer.  Second,
  932. Xthe letter, "c" is presented to the network together with p1 now on
  933. Xunits 5-7.  This will give "b" on the output units.  However, if the "b"
  934. Xfrom the second string is presented first there will be a different
  935. Xrandom pattern, p2, on the hidden layer units.  These values are copied
  936. Xdown to input units 5-7.  These values combine with the "c" to produce
  937. Xthe output, "d".
  938. X
  939. X   The training patterns for the network can be:
  940. X
  941. X     1000 000   0010  * "a" prompts the output, "c"
  942. X     0010 hhh   0100  * inputting "c" should produce "b"
  943. X
  944. X     0100 000   0010  * "b" prompts the output, "c"
  945. X     0010 hhh   0001  * inputting "c" should produce "d"
  946. X
  947. Xwhere the first four values on each line are the normal input, the
  948. Xmiddle three either start out all zeros or take their values from the
  949. Xprevious values of the hidden units.  The code for taking these values
  950. Xfrom the hidden layer units is "h".  The last set of values represents
  951. Xthe output that should be produced.  To take values from the third layer
  952. Xof a network, the code is "i".  For the fourth and fifth layers (if they
  953. Xexist) the codes are "j" and "k".  Training recurrent networks can take
  954. Xmuch longer than training standard networks and the average error can
  955. Xjump up and down quite a lot.
  956. X
  957. X
  958. X12. The Benchmarking Command
  959. X
  960. X   The main purpose of the benchmarking command is to make it possible
  961. Xto run a number of tests of a problem with different initial weights and
  962. Xaverage the number of iterations and CPU time for networks that
  963. Xconverged.  A second purpose is to run a training set thru the network a
  964. Xnumber of times and for each try a test pattern or a test set can be
  965. Xchecked at regular intervals.
  966. X
  967. X   A typical command to simply test the current parameters on a number
  968. Xof networks is:
  969. X
  970. XB g 5 m 15 k 1 r 1000 200
  971. X
  972. XThe "g 5" specifies that you'd like to set the goal of getting 5
  973. Xnetworks to converge but the "m 15" sets a maximum of 15 tries to
  974. Xreach this goal.  The k specifies that each initial network will get
  975. Xa kick by setting each weight to a random number between -1 and 1.
  976. XThe "r 1000 200" portion specifies that you should run up to 1000
  977. Xiterations on a network and print the status of learning every 200
  978. Xiterations.  This follows the normal run command and the second
  979. Xparameter defining how often to print the statistics can be omitted.
  980. XFor example, here is some output from benchmarking with the xor problem:
  981. X
  982. X[?!*AaBbCcdefHhiklmnOoPpQqRrSstWwx]? B g 5 m 5 k 1 r 200
  983. X seed =      7; running . . .
  984. Xpatterns learned to within 0.10 at iteration 62
  985. X seed =      7; running . . .
  986. X seed =      7; running . . .
  987. Xpatterns learned to within 0.10 at iteration 54
  988. X seed =      7; running . . .
  989. Xpatterns learned to within 0.10 at iteration 39
  990. X seed =      7; running . . .
  991. Xpatterns learned to within 0.10 at iteration 44
  992. X1 failures; 4 successes; average = 49.750000     0.333320 sec/network
  993. X
  994. XThe time/network includes however much time is used to print messages so
  995. Xto time the process effectively all printing should be minimized.  When
  996. Xthe timing is done on a UNIX PC the time returned by clock will overflow
  997. Xafter 2147 seconds or about 36 minutes.  If you system has the same
  998. Xlimitation take care that ALL of the benchmarking you do in a single
  999. Xcall of the program adds up to less than 36 minutes.
  1000. X
  1001. X   In the above example the seed that was used to set the random values
  1002. Xfor the weights was set to 7 (outside the benchmarking command) however
  1003. Xif you set a number of seeds as in:
  1004. X
  1005. Xs 3 5 7 18484 99
  1006. X
  1007. Xthe seeds will be taken in order for each network.  When there are more
  1008. Xnetworks to try than there are seeds the random values keep coming from
  1009. Xthe last seed value so actually you can get by using a single seed.
  1010. XThe idea behind allowing multiple seeds is so that if one network does
  1011. Xsomething interesting you can use that seed to run a network with the
  1012. Xsame initial weights outside of the benchmarking command.
  1013. X
  1014. X   Once the benchmarking parameters have been set it is only necessary
  1015. Xto include the run portion in order to start the benchmarking process
  1016. Xagain, thus, "B r 200" will run benchmarking again using the current set
  1017. Xof parameters.  Also, the parameters can be set without starting the
  1018. Xbenchmarking process by just not including the `r' parameters in the B
  1019. Xcommand as in:
  1020. X
  1021. XB g 5 m 5 k 1
  1022. X
  1023. X   In addition to getting data on convergence you can have the program
  1024. Xrun test patterns thru the network at the print statistics rate given
  1025. Xin the `r' sub-command.  To specify the test file, test100, use:
  1026. X
  1027. XB t f test100
  1028. X
  1029. XTo run the training data thru for up to 1000 iterations and test every
  1030. X200 iterations use:
  1031. X
  1032. XB r 1000 200
  1033. X
  1034. XIf the pattern format specification p is set to either c or g you will
  1035. Xget a summary of the patterns on the test file.  If p is either C or G
  1036. Xyou will get the results for each pattern listed as well as the summary.
  1037. XTo stop testing the data on the data file use "B t 0".
  1038. X
  1039. X   Sometimes you may have so little data available that it is difficult
  1040. Xto separate the patterns into a training set and a test set.  One
  1041. Xsolution is to remove each pattern from the training set, train the
  1042. Xnetwork on the remaining patterns and then test the network on the
  1043. Xpattern that was removed.  To remove a pattern, say pattern 1 from the
  1044. Xtraining set use:
  1045. X
  1046. XB t 1
  1047. X
  1048. XTo systematically remove each pattern from the training set use a data
  1049. Xfile with the following commands:
  1050. X
  1051. XB t 1 r 200 50
  1052. XB t 2 r 200 50
  1053. XB t 3 r 200 50
  1054. X ... etc.
  1055. X
  1056. Xand the pattern will be tested every 50 iterations.  If, in the course
  1057. Xof training the network, all the patterns converge, the program will
  1058. Xprint out a line starting with a capital S followed by a test of the
  1059. Xtest pattern.  If the programs hits the point where statistics on the
  1060. Xlearning process have to be printed and the network has not converged
  1061. Xthen a capital F will print out followed by a test of the test pattern.
  1062. XTo stop this testing use "B t 0".
  1063. X
  1064. X   It would be nice to have the program average up and tabulate all the
  1065. Xdata that comes out of the benchmarking command but I thought I'd leave
  1066. Xthat to users for now.  You can use the record command to save the
  1067. Xoutput from the entire session and then run it thru some other program,
  1068. Xsuch as an awk program in order to sort everything out.
  1069. X
  1070. X
  1071. X13. Miscellaneous Commands
  1072. X
  1073. X   Below is a list of some miscellaneous commands, a short example of
  1074. Xeach and a short description of the command.
  1075. X
  1076. X
  1077. X!   Example: ! ls
  1078. X
  1079. XAnything after `!' will be passed on to the OS as a command to execute.
  1080. X
  1081. X
  1082. XC   Example: C
  1083. X
  1084. XThe C command will clear the network of values, reset the number of
  1085. Xiterations to 0 and reset other values so that another run can be made.
  1086. XThe seed value is reset so you can run the same network over with the
  1087. Xsame initial weights but with different learning parameters.  Even
  1088. Xthough the seed is reset the weights are not initialized so you
  1089. Xmust do this step after clearing the network.
  1090. X
  1091. X
  1092. Xi   Example: i f
  1093. X
  1094. XEntering "i f" will read commands from the file, f.  When there are no
  1095. Xmore commands on the file the program resumes reading from the previous
  1096. Xfile being used.  You can also have an `i' command within the file f,
  1097. Xhowever the depth to which you can nest the number of active files is 4
  1098. Xand stdin itself counts as the first one.  Once an input file has been
  1099. Xspecified you can simply type "i" to read from the file again.
  1100. X
  1101. X
  1102. Xl   Example: l 2
  1103. X
  1104. XEntering "l 2" will print the values of the units on layer 2, or
  1105. Xwhatever layer is specified.
  1106. X
  1107. X
  1108. XT   Example: T -3
  1109. X
  1110. XIn sbp and srbp only, "T -3" sets all the threshold weights to -3 or
  1111. Xwhatever value is specified and freezes them at this value.
  1112. X
  1113. X
  1114. XW   Example: W 0.9
  1115. X
  1116. XEntering "W 0.9" will remove (whittle away) all the weights with
  1117. Xabsolute values less than 0.9.
  1118. X
  1119. XIn addition, under UNIX when a user generated interrupt occurs (by
  1120. Xtyping DEL) the program will drop its current task and take the next
  1121. Xcommand from the keyboard.  Under DOS you can use ctrl-C to stop the
  1122. Xcurrent task and take the next command from the keyboard.  Also under
  1123. XDOS, when the program is executing a run command hitting the escape key
  1124. Xwill get the program to stop after the current iteration.
  1125. X
  1126. X
  1127. X13. Limitations
  1128. X
  1129. X   Weights in the bp and sbp programs are 16-bit integer weights where
  1130. Xthe real value of the weight has been multiplied by 1024.  The integer
  1131. Xversions cannot handle weights less than -32 or greater than 31.999.
  1132. XThe weight changes are all checked for overflow but there are other
  1133. Xplaces in these programs where calculations can possibly overflow as
  1134. Xwell and none of these places are checked.  Input values for the integer
  1135. Xversions can run from -31.994 to 31.999.  Due to the method used to
  1136. Ximplement recurrent connections, input values in the real version are
  1137. Xlimited to -31994.0 and above.
  1138. END_OF_FILE
  1139. if test 46585 -ne `wc -c <'readme'`; then
  1140.     echo shar: \"'readme'\" unpacked with wrong size!
  1141. fi
  1142. # end of 'readme'
  1143. fi
  1144. echo shar: End of archive 1 \(of 4\).
  1145. cp /dev/null ark1isdone
  1146. MISSING=""
  1147. for I in 1 2 3 4 ; do
  1148.     if test ! -f ark${I}isdone ; then
  1149.     MISSING="${MISSING} ${I}"
  1150.     fi
  1151. done
  1152. if test "${MISSING}" = "" ; then
  1153.     echo You have unpacked all 4 archives.
  1154.     rm -f ark[1-9]isdone
  1155. else
  1156.     echo You still need to unpack the following archives:
  1157.     echo "        " ${MISSING}
  1158. fi
  1159. ##  End of shell archive.
  1160. exit 0
  1161.  
  1162. exit 0 # Just in case...
  1163.