📄 io.c
字号:
sprintf(outstr,"qp m %4.2f ",unscale(mu)); pg(stdout,outstr);
pg(stdout,"quickprop acceleration (mu); (1..inf)\n");
sprintf(outstr,"qp n %5.3f ",unscale(qpnoise)); pg(stdout,outstr);
pg(stdout,"quickprop noise (ibp only); [0..inf)\n");
sprintf(outstr,"qp s %c ",qpslope); pg(stdout,outstr);
pg(stdout,"include or exclude extra slope term; {+-}\n");
pg(stdout,"\na u q use this to set the quickprop update method\n");
pg(stdout,"\n");
return;
case 'T':
pg(stdout,"\nA Tutorial\n\n");
pg(stdout,"The following topics are designed to be read in the order listed.\n\n");
pg(stdout,"To get help on a topic type the code on the right at the prompt.\n\n");
pg(stdout,"Understanding the Menus h1\n");
pg(stdout,"Formatting Data for a Classification Problem h2\n");
pg(stdout,"Formatting Data for Function Approximation h3\n");
pg(stdout,"Formatting Data for a Recurrent Problem h4\n");
pg(stdout,"Making a Network for Classification or Function Approximation h5\n");
pg(stdout,"Making a Recurrent Network h6\n");
pg(stdout,"Reading the Data h7\n");
pg(stdout,"Setting Algorithms and Parameters h8\n");
pg(stdout,"Running the Program h9\n");
pg(stdout,"Saving Almost Everything h10\n");
pg(stdout,"To Quit the Program h11\n\n");
return;
case 'W':
pg(stdout,"\nWeights Related Commands\n\n");
pg(stdout,"rw reads weights from the file "); pg(stdout,wtfilename);
pg(stdout,"\n");
pg(stdout,"sw saves weights to the file "); pg(stdout,wtfilename);
pg(stdout,"\n");
pg(stdout,"rw <filename> reads weights from <filename>\n");
pg(stdout,"sw <filename> save weights to <filename>\n");
sprintf(outstr," last save at: %1d\n\n",lastsave);
pg(stdout,outstr);
pg(stdout,"w <layer> <unit> list weights leading into this unit\n\n");
if (biasset == 1)
{
sprintf(outstr,"sb %5.2f ",unscale(stdthresh)); pg(stdout,outstr);
pg(stdout,"bias units set to this value\n\n");
}
else pg(stdout,"sb <real> set bias weights to <real>\n\n");
printnetsize(stdout);
pg(stdout,"\n");
sprintf(outstr," total weights: %1d\n",wttotal);
pg(stdout,outstr);
#ifdef INTEGER
if (wtlimithit == 1)
pg(stdout,"\n >>>>> WEIGHT LIMIT HIT <<<<<\n");
#endif
pg(stdout,"\n");
return;
default: pg(stdout,"not a screen item\n");
return;
}; /* end switch */
}
void help()
{
int ch2;
pg(stdout,"\n");
do ch2 = readch(); while (ch2 == ' ' && ch2 != '\n');
switch(ch2) {
default: menus('C'); return;
case '1':
ch2 = readch();
switch(ch2) {
case '0':
pg(stdout,"\n");
pg(stdout,"It is possible to use the program by typing in all the commands at the\n");
pg(stdout,"keyboard yet it is more convenient to have the basic set up commands for\n");
pg(stdout,"a particular problem in a file, have the program read the file and then\n");
pg(stdout,"have it take commands from the keyboard. So if you have a file named\n");
pg(stdout,"xor set up you can start the program with:\n");
pg(stdout,"\n");
pg(stdout,"bp xor\n");
pg(stdout,"\n");
pg(stdout,"After working with the problem you may reset many parameters. To save\n");
pg(stdout,"the current set of parameters and weights (but not the patterns which\n");
pg(stdout,"are normally in files of their own) use the save everything command,\n");
pg(stdout,"`se'. So to save the current state of the program to a file called,\n");
pg(stdout,"say, new, do:\n");
pg(stdout,"\n");
pg(stdout,"se new\n");
pg(stdout,"\n");
pg(stdout,"The file new will be virtually identical to the listing you get with\n");
pg(stdout,"the `?' command. Later on you can restart the problem with:\n");
pg(stdout,"\n");
pg(stdout,"bp new\n");
pg(stdout,"\n");
return;
case '1':
pg(stdout,"In DOS and UNIX type `q' at the command line prompt.\n\n");
pg(stdout,"In DOS you can hit the escape key to stop a training run.\n\n");
pg(stdout,"In DOS and UNIX you can hit ctrl-C to stop anything and get to the\n");
pg(stdout,"command prompt. When used in a DOS window under Windows this may\n");
pg(stdout,"produce an error message as well as stopping the program.\n\n");
return;
case '\n':
bufferptr = bufferptr - 1;
pg(stdout,"Understanding the Menus\n\n");
pg(stdout,"First, this program includes a paging algorithm similar to more. When\n");
pg(stdout,"you get the string:\n");
pg(stdout,"\n");
pg(stdout,"More?\n");
pg(stdout,"\n");
pg(stdout,"at the bottom of the screen you can get one more page by hitting the\n");
pg(stdout,"space bar, one more line by hitting the carriage return, half a page\n");
pg(stdout,"with ctrl-D, a c will continue without paging and in most cases typing\n");
pg(stdout,"a q will stop the paging. There is no scrolling backwards.\n\n");
pg(stdout,"While the program does not use a mouse or windows it does have menus to\n");
pg(stdout,"make it easy to see what the commands are. One typical menu is the F\n");
pg(stdout,"for format menu, so if you type F at the command prompt you get:\n\n");
pg(stdout,"The Format Command (f)\n\n");
pg(stdout,"f b - ring the bell when training is finished; {+-}\n");
pg(stdout,"f c + make a copy of screen i/o on the file copy; {+-}\n");
pg(stdout,"f e - echo input; {+-}\n");
pg(stdout,"f i r format for reading input and output patterns; {cr} h fi\n\n");
pg(stdout,"plus there is more that has been deleted but these four lines show enough.\n");
pg(stdout,"The first column gives the command and the current value of the parameter.\n");
pg(stdout,"In the `f b -' string, the `f' is the general format command that\n");
pg(stdout,"includes many sub-commands. The `b' sub-command controls the ringing\n");
pg(stdout,"of the bell when the program finishes learning. With the `-' it is off.\n");
pg(stdout,"The middle portion of the screen gives the function involved with the\n");
pg(stdout,"command. Characters at the end within { and } list the possible options.\n");
pg(stdout,"For ringing the bell it is on or off, `+' or `-'. In the `f i r' the\n");
pg(stdout,"explanation for c and r within the { and } can be found by typing `h f i'\n");
pg(stdout,"at the normal command prompt. To change the settings you only have to\n");
pg(stdout,"type the command string in the left column but with the new parameter\n");
pg(stdout,"setting.\n\n");
pg(stdout,"In many cases the command parameters are numbers. The range of values\n");
pg(stdout,"that the parameter can take on are given using [, ], (, and ). If the\n");
pg(stdout,"range listed is: [0..1) the [ next to 0 means that the lowest possible\n");
pg(stdout,"value allowed is exactly 0 while the ) indicates that you can get very\n");
pg(stdout,"close to 1 but never exactly 1.\n\n");
pg(stdout,"In some cases the leftmost column will code a possible command parameter\n");
pg(stdout,"using some name within < and >. For instance there are these two\n");
pg(stdout,"examples:\n\n");
pg(stdout,"qp d <real> sets quickprop weight decay to <real> in all layers\n\n");
pg(stdout,"sw <filename> save weights to <filename>\n");
pg(stdout,"\n");
pg(stdout,"In the first case it means that to set the quickprop decay in all layers\n");
pg(stdout,"to some value you type `qp d' and some real number as in:\n\n");
pg(stdout,"qp d 0.0001\n\n");
pg(stdout,"In the second example the command means save the weight to some filename\n");
pg(stdout,"so type the name in place of `<filename>'.\n\n");
return;
default: pg(stdout,"not a help item\n\n");
return;
}; /* end the inner switch */
case '2':
pg(stdout,"The normal way to operate this program is to have the training data\n");
pg(stdout,"in one file and if there is test set data it should be in another file.\n\n");
pg(stdout,"For a plain classification program, with say four inputs and 3 possible\n");
pg(stdout,"classes the data file will look like:\n\n");
pg(stdout,"0.4 0.3 0.33 0.21 1 * this is a class 1 pattern\n");
pg(stdout,"0.55 0.32 -0.09 0.20 2 * this is a class 2 pattern\n");
pg(stdout,"0.11 0.23 -0.97 0.45 3 * this is a class 3 pattern\n\n");
pg(stdout,"where the first four numbers are the input and the last number is the\n");
pg(stdout,"class number. If there are a large number of inputs you can use more\n");
pg(stdout,"than one line for each pattern but you should start every new pattern\n");
pg(stdout,"on a new line. The asterisk at the end of the line begins a comment.\n\n");
pg(stdout,"It is also possible to type the data in as commands but this is\n");
pg(stdout,"generally not a good idea unless you have a very small data set\n");
pg(stdout,"because you will probably make many mistakes when typing the data\n");
pg(stdout,"in.\n\n");
return;
case '3':
pg(stdout,"The normal way to operate this program is to have the training data\n");
pg(stdout,"in one file and if there is test set data it should be in another file.\n\n");
pg(stdout,"For a function approximation program with say five inputs and 1 output\n");
pg(stdout,"the data should look like:\n\n");
pg(stdout," -1.588 -1.650 0.365 0.188 0.962 -1.543\n");
pg(stdout," -1.182 -0.926 0.992 0.188 1.140 -1.372\n");
pg(stdout," -2.650 -1.650 3.501 0.188 -0.566 -1.201\n\n");
pg(stdout,"where the first five numbers are the input and the last number is the\n");
pg(stdout,"answer. If there are a large number of inputs you can use more\n");
pg(stdout,"than one line for each pattern but you should start every new pattern\n");
pg(stdout,"on a new line.\n\n");
pg(stdout,"It is also possible to type the data in as commands but this is\n");
pg(stdout,"generally not a good idea unless you have a very small data set because\n");
pg(stdout,"you will probably make many mistakes when typing the data in.\n\n");
return;
case '4':
pg(stdout,"The normal way to operate this program is to have the training data\n");
pg(stdout,"in one file and if there is test set data it should be in another file.\n\n");
pg(stdout,"For a recurrent network problem, with say four inputs and 4 possible\n");
pg(stdout,"outputs the data file will look like:\n\n");
pg(stdout,"1 0 0 0 H 0 0 1 0\n");
pg(stdout,"0 0 1 0 H 0 1 0 0\n");
pg(stdout,"0 1 0 0 H 0 0 1 0\n");
pg(stdout,"0 0 1 0 H 0 0 0 1\n\n");
pg(stdout,"where the first four numbers are the input, the H stands for the values\n");
pg(stdout,"of the hidden layer units that are copied down to the input and the last\n");
pg(stdout,"four numbers are the output. If there are a large number of inputs you\n");
pg(stdout,"can use more than one line for each pattern but you should start every\n");
pg(stdout,"new pattern on a new line.\n\n");
pg(stdout,"It is also possible to type the data in as commands but this is\n");
pg(stdout,"generally not a good idea unless you have a very small data set\n");
pg(stdout,"because you will probably make many mistakes when typing the data in.\n\n");
return;
case '5':
pg(stdout,"The command to type in to make a network with four inputs, three\n");
pg(stdout,"hidden layer units and two output units is:\n\n");
pg(stdout,"m 4 3 2\n\n");
pg(stdout,"In many cases adding extra connections from the input units to the\n");
pg(stdout,"output units will produce faster training. If you wanted to use the\n");
pg(stdout,"extra connections type in:\n\n");
pg(stdout,"m 4 3 2 x\n\n");
pg(stdout,"NOTE: there is no way to know ahead of time how many hidden units will\n");
pg(stdout,"be needed or if hidden units will be needed at all.\n\n");
pg(stdout,"NOTE: when patterns are read in they are attached to the network\n");
pg(stdout,"structure so if you make a different size network, such as a 4-5-2\n");
pg(stdout,"network after the patterns are read in the patterns will be lost and\n");
pg(stdout,"you will have to read them in again.\n\n");
return;
case '6':
pg(stdout,"The command to type in to make a recurrent network with four normal\n");
pg(stdout,"input units and three more input units that have values copied from\n");
pg(stdout,"the three hidden layer units and with two output units is:\n\n");
pg(stdout,"m 4+3 3 2\n\n");
pg(stdout,"The 3 in the `4+3' portion must be the same value as the 3 following it.\n\n");
return;
case '7':
pg(stdout,"If you're doing a classification type problem it is important to first\n");
pg(stdout,"let the program know that using the `f' (format) command so the last\n");
pg(stdout,"number can be interpreted as the class number, use:\n\n");
pg(stdout,"f p c * the problem type is classification\n\n");
pg(stdout,"If you're doing a function approximation type of problem, do nothing\n");
pg(stdout,"since the default setting (g, for general) will work.\n\n");
pg(stdout,"To read in the training set data from some file called, say train is:\n\n");
pg(stdout,"rt train * rt is for read training\n\n\n");
pg(stdout,"To read in any test set data from some file called, say, test is:\n\n");
pg(stdout,"tf test * tf is for test file\n\n\n");
pg(stdout,"For other ways to read in data see the manual.\n\n");
return;
case '8':
pg(stdout,"There are many algorithms that can be tried and there are many\n");
pg(stdout,"parameters for each algorithm that can be varied, some algorithms and\n");
pg(stdout,"values produce faster training while others may produce better\n");
pg(stdout,"generalization. So far there is no way to know ahead of time which\n");
pg(stdout,"algorithms and values are best. The fastest training algorithm in this\n");
pg(stdout,"program is quickprop. To get fairly good results set the quickprop eta\n");
pg(stdout,"parameter to about 1 / n where n is the number of patterns in the\n");
pg(stdout,"training set. So if n = 100 type in:\n\n");
pg(stdout,"qp e 0.01 * sets the quickprop eta to 0.01\n\n");
pg(stdout,"and set the algorithm to use to quickprop with the algorithm command:\n\n");
pg(stdout,"a uq * sets the update algorithm to quickprop.\n\n");
pg(stdout,"This will probably work well (NO GUARANTEE) with the other default\n");
pg(stdout,"parameters in the program.\n\n");
pg(stdout,"If you need outputs beyond the range of 0 to 1 use the algorithm\n");
pg(stdout,"command to make the output layer linear:\n\n");
pg(stdout,"a aol * activation function for the output layer is linear\n\n");
return;
case '9':
pg(stdout,"\n");
pg(stdout,"Normally you want to initialize the weights in the network with small random\n");
pg(stdout,"values. This is done with the clear and initialize command, type in:\n");
pg(stdout,"\n");
pg(stdout,"ci * ci for clear and initialize\n");
pg(stdout,"\n");
pg(stdout,"Having done that you can run the training program by typing `r' and a\n");
pg(stdout,"carriage return or by typing ctrl-R. Doing this applies the training\n");
pg(stdout,"algorithm for up to 100 passes through the training set data and lists\n");
pg(stdout,"the status of the training set and the test set if it exists. For the\n");
pg(stdout,"sonar data included in the sample data the listing will look like:\n");
pg(stdout,"\n");
pg(stdout," 10 49.04 % 49.04 % 0.47063 62.50 % 62.50 % 0.38221 \n");
pg(stdout," 20 70.19 % 73.08 % 0.38548 77.88 % 77.88 % 0.38063 \n");
pg(stdout," 30 76.92 % 76.92 % 0.34943 77.88 % 80.77 % 0.33282 \n");
pg(stdout,"\n");
pg(stdout,"The first column is the iteration number, the second column gives the\n");
pg(stdout,"percentage of training set patterns right based on the tolerance the\n");
pg(stdout,"third column gives the percentage right based on the maximum value, the\n");
pg(stdout,"fourth column gives the abs (not RMS!) error. The fifth column is the\n");
pg(stdout,"percentage of test set patterns right based on the tolerance, the sixth\n");
pg(stdout,"column gives the percentage right based on maximum value and the last\n");
pg(stdout,"column gives the abs error.\n");
pg(stdout,"\n");
return;
case 'a':
do ch2 = readch(); while (ch2 == ' ');
if (ch2 == 'd')
{
pg(stdout,"a d c uses the original (correct) derivative.\n\n");
pg(stdout,"a d d uses the differential step derivative in the output layer.\n");
pg(stdout,"a d f uses Fahlman's derivative in the output layer.\n");
pg(stdout,"a d o uses the original (correct) derivative.\n\n");
}
else if (ch2 == 'a')
{
pg(stdout,"a a <char> sets every activation function to <char>.\n");
pg(stdout,"a ah <char> sets the hidden layer activation function to <char>.\n");
pg(stdout,"a ao <char> sets the output layer activation function to <char>,\n");
pg(stdout,"<char> can be any of the following:\n\n");
pg(stdout,"<char> Function Range\n\n");
pg(stdout," l linear function, x (-inf..+inf)\n");
pg(stdout," s standard sigmoid, 1 / (1 + exp(-x)) (0..+1)\n");
}
else if (ch2 == 'u')
{
pg(stdout,"a u C gives the \"right\" continuous update method.\n");
pg(stdout,"a u c gives the \"wrong\" continuous update method.\n");
#ifndef SYMMETRIC
pg(stdout,"a u d gives the delta-bar-delta update method.\n");
#endif
pg(stdout,"a u p gives the periodic update method.\n");
#ifndef SYMMETRIC
pg(stdout,"a u q gives the quickprop update method.\n");
#endif
}
else texterror(); /* end of the 'a' case */
break;
case 'f':
do ch2 = readch(); while (ch2 == ' ');
if (ch2 == 'B')
{
pg(stdout,"B <int1> <int2> ... <inti> ... <int20> puts a carriage return\n");
pg(stdout," after each <inti> values when the output format is real\n");
pg(stdout," and inserts a blank after each <inti> value if the\n");
pg(stdout," format is condensed.\n\n");
}
else if (ch2 == 'i')
{
pg(stdout,"i c will read pattern values using compressed format.\n");
pg(stdout,"i r will read pattern values as reals.\n\n");
}
else if (ch2 == 'o')
{
pg(stdout,"o a will write node values as analog compressed.\n");
pg(stdout,"o c will write node values as compressed.\n");
pg(stdout,"o e will write node values with e notation.\n");
pg(stdout,"o r will write node values as real.\n\n");
}
else if (ch2 == 'p')
{
pg(stdout,"p c will read patterns in the classification format.\n");
pg(stdout,"p g will accept general patterns.\n\n");
}
else texterror();
break;
case 't':
do ch2 = readch(); while (ch2 == ' ');
if (ch2 == 'r')
{
pg(stdout,"tr <int> in a recurrent network takes each training set pattern\n");
pg(stdout," and its <int> - 1 following patterns and predicts the\n");
pg(stdout," <int> + 1st pattern\n");
pg(stdout,"trp <int> does the same and prints the predicted patterns\n");
}
else texterror();
break;
}; /* end switch */
pg(stdout,"\n");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -