12 Output Files

The model output files contain information about the optimisation process (and not information about the stocks in the model - see the section on the Print Files, section 9, for information on these). The output files are specified by some of the commandline parameters used to start Gadget. There are three types of output file.

12.1 Parameter Output

The parameter output file is automatically generated by Gadget every time that Gadget is run. If Gadget is not started with the “-p \(<\)filename\(>\)” option, this file will be called “params.out”. This file contains information about the values of the switches at the end of the Gadget run, in the same format as for the column output file. In the header of this file there will be information about the Gadget run, followed by the final overall likelihood score and the total number of iterations. There is then the information about the switches used in the Gadget run - the name, value, lower bound, upper bound and whether the switch is to be optimised.

This file is written in the same format as the parameter input file, and it can be used as the starting point for a subsequent Gadget run.

12.2 Likelihood Output

The likelihood output file is generated when Gadget is started with the “-o \(<\)filename\(>\)” option, and the output is written to the file specified after that option, so, for example, this would write the output to a file called “likelihood.txt”:

gadget -l -o likelihood.txt

The likelihood output file is split into three sections, separated by a line containing a brief comment. The first section lists the names of the switches used in the model, together with some information about where that switch is used.

The second part of the likelihood output file contains information about the likelihood components used in the optimisation of the model. The names of the components are listed, along with an identifier to the type and the weight assigned to the component.

The final part of the likelihood output file contains the output from the optimisation process. There is a single line for each iteration of the optimisation, containing the iteration number followed by a tab character, then the value of each switch, followed by a gap (2 tab characters), followed by the value of each of the likelihood components, followed by another gap (again, 2 tab characters) followed by the overall likelihood score for that iteration.

For a long optimisation run, this can result in this file being quite large. The default option is for this line to be written for each iteration, but this can be changed using the “-print \(<\)number\(>\)” option, which will only write out this line every \(<\)number\(>\) iterations, as shown in the example below:

gadget -l -o likelihood.txt -print 10

which will set Gadget to write this information, to the file “likelihood.txt”, after every 10th iteration.

12.3 Log Output

The log output file is generated when Gadget is started with the “-log \(<\)filename\(>\)” option, and the output is written to the file specified after that option, so, for example, this would write the output to a file called “gadget.log”:

gadget -log gadget.log

The log file contains a listing of the actions that Gadget is performing, as those actions are being performed - an entry can be made whenever data is read from a file, or a likelihood score is calculated, for example. The log file is of most use when initially setting up and debugging a Gadget model, since it makes it easy to trace what Gadget is doing, so, for example, the details of the last actions that were performed before displayed a warning message are recorded.

This log file that is generated can be a large file if Gadget is performing an optimising run. It is possible to control the amount of information that is written to the log file using the “-loglevel \(<\)number\(>\)” command line option. The valid values for the loglevel number, and the associated meanings, are given in the list below:

loglevel meaning
0 no output, only used in conjunction with the Paramin optimiser
1 output informational messages only (cannot be set from the command line)
2 also output error messages (default value for an optimising run)
3 also output warning messages (default value for a simulation run)
4 also output debug messages (only useful when debugging Gadget code)
5 also output detailed messages (default value if a log file is specified)

Examples of valid loglevel values include:

  1. specifying a log file (called “gadget.log”) for an optimising run that only includes informational and error messages (and not the more detailed messages that would be written to the log file by default)

    gadget -l -log gadget.log -loglevel 2
  2. specifying a log file for a simulation run that includes error and warning messages (note that it is not possible to disable the warning messages during a simulation run)

    gadget -s -log gadget.log -loglevel 3