How to use NetGen

Richard Hawkings (OPAL) and Alain Bellerive (SNO)


NetGen is a program which takes a JETNET3 output file (as produced by JNDUMP) and translates it into a standalone subroutine containing the code and DATA statements to execute a particular trained neural net. The neural nets you have trained can thus be `packaged' and used in other programs, independantly of the JETNET code. This is also useful if you want to use more than one neural net in your program at once.

To use NetGen, proceed as follows:

  1. Download the netgen shell script to your machine. You will also need the source code for the JETNET routines, as some of them are used by NetGen. Give the netgen file execute permission by typing:
     chmod +x netgen
    

  2. Modify (if necessary) the script to run on your machine. You may need to change the lines giving the command to invoke the FORTRAN compiler, and the location of the JETNET source code on your system.

  3. Run the program using the following syntax:
     netgen your_jetnet_file output_file subroutine_name
    
    where your_jetnet_file is the name of the file written by JNDUMP, output_file is the name of the file to be produced, and subroutine_name is the name of the subroutine you want to be generated.

    Look in the SNOBOY directory for the netgen file for example 1 (i.e. netgen_examp1). It is important to notice that the JETNET program will need examp1.jn to produce the neural net parameters, which are parametrised in the DATA statement of output_file.

  4. Edit the resulting file to set up the neural net inputs. The skeleton contains the following code which must be changed: * fill in your own input values into the first layer of the net VN(1,1)= ?? VN(2,1)= ?? VN(3,1)= ?? * etc... which you should change to setup the inputs you want. As generated, the subroutine has only one argument - the network output, but you can modify the argument list to pass in the parameters directly e.g. as follows: SUBROUTINE MYNET(XINPUT,OUT) . . REAL XINPUT(3) INTEGER I . . DO I=1,3 VN(I,1)=XINPUT(I) ENDDO Or you could pass in some other parameter - e.g. a track number and compute the inputs from the track number using other information in COMMON blocks.

  5. Copy the finished routine into your program.


How it works

The script first compiles a FORTRAN program which contains code to read in a network configuration, and output the appropriate DATA statements and array definitions. These output files are then combined with code contained in the script to produce the complete subroutine. For historical reasons, the JETNET file to DATA statement conversion is performed by via a simplified temporary file format.

Restrictions

Some of the fancier JETNET features are not supported - only basic multilayer feed-forward networks have been tested. The network temperature must not change between layers, and only type 1 and 2 transfer functions are implemented. The program has so far only been tested with JETNET3.4 More functionality could be added if required.