Professional Basis of AI Backprop Hypertext Documentation

Copyright (c) 1990-97 by Donald R. Tveter

The Input Command

Entering "i f" will read commands from the file, f. When there are no more commands on the file the program resumes reading from the previous file being used. You can also have an `i' command within the file f, however the depth to which you can nest the number of active files is 10 and stdin itself counts as the first one. (If 10 is not enough, increase the definition of MAXFILES in the files bp.h and ibp.h.) Once an input file has been specified you can simply type "i" followed by a carriage return to read from the file again. The i command then lets you create your own complex command built out of a series of simple commands. For example, you may want to run the xor problem and print out all 4 patterns after every iteration. If you create a file called, say, print and it contains the commands:

r 1 1
p
you type in:

i print
once and thereafter you can type i followed by a carriage return. There is another option on the command to read the file as many times as you like. To get the program to run the commands in the file print 10 times you can enter:

i print 10
Thereafter, entering i will read the file 10 times as well. Of course if the network converges to within the desired tolerance before 10 reads of the file it is a waste of time so the program breaks this loop if all the training set patterns are learned within the specified tolerance. Also the output from these commands will be subject to paging, however if you don't want paging you can either turn it off in the usual way. When you take input from another file the looping parameter is set/reset to 1 unless you explicitly give it a number of times to re-read the file.

The important use for this looping capability is that you can run one network trial after another as in benchmarking except you can specify all the actions you want taken during each run. Of course you do lose the averaging and timing capabilities of the benchmark command with this arrangement. The example below gives the sequence that is typed in from the keyboard file, stdin and the file onerun is shown along side it:

stdin                onerun
-----------          ----------
si+                  r 1000 100
ci                   p
i onerun 10          ci
Typing in "si+" sets the program so that it will advance the seed after every clear command. The "ci" is typed at the keyboard and initializes the network. Then the file onerun is read 10 times. In onerun the command "r 1000 100" is run until 1000 is reached or the network converges. Then the patterns are printed out with the "p" command, then the network is reset. Notice that resetting the network at this point is critical to making the program read onerun 10 times. If the "ci" in onerun was not present the program finds the problem solved and the remaining 9 reads of the file onerun are skipped.

Below is a slightly more complicated example where the training patterns are printed out every 100 iterations up to a maximum of 1000 iterations:

stdin                onerun               bunch
-----------          ----------           ---------
si+                  i bunch 10           r 100 100
ci                   ci                   p
i onerun 10
Once again the seeds are incremented, the network is initialized, and ten calls are made to read the file onerun. However now the file onerun calls the file bunch to do 10 runs using "r 100 100". If after running the commands in bunch the network has converged any extra calls to read bunch are ignored, the network is re-initialized and onerun is read again. For that matter, the commands you type in to stdin can be placed in another file called, say, tenruns, and then at the stdin level you only need to say:

i tenruns
Note that at the end of all this computing the last filename given to an input command will have been the filename, bunch, not tenruns.

Note that with the above arrangements the only way to stop the whole process and return to the command prompt is to generate an interrupt in UNIX or use ctrl-C from W95 and neither one works at the moment :(. In UNIX you can pop up a new shell and kill the whole process, similarly for W95.