home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume28 / backprop / part01 next >
Text File  |  1992-02-23  |  51KB  |  1,138 lines

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