# Files: Activation Output Files

Activation files are used for recording the outputs and targets of the network during training or testing. The network's performance can then be evaluated with a separate program. These files could also be used to help generate examples on the fly based on the network's current performance.

The command openNetOutputFile begins the writing of an activation output file. Each time the network processes an example, the values will be written to the file. This continues until closeNetOutputFile is called.

Only groups with the WRITE_OUTPUTS type will have their outputs written to the file. If the group also is of type OUTPUT, its targets will be written as well. By default, only OUTPUT groups are given the WRITE_OUTPUTS type.

Output files may be written in text or binary format. Because these involve floating point numbers, the binary format will tend to be smaller. It will also be faster to parse later on, if speed is an issue. Using compression will reduce the size difference.

The Network's `writeExample()` function pointer is used to write the outputs for the current example. The behavior of the default function, `standardWriteExample()`, is described below. If you want to customize the output file format, you can write your own C function to replace `standardWriteExample()` and then set the network's `writeExample()` pointer to your function. This should be done in extension.h.

### Text Format

The text format is as follows. The format specification is described in the Example Files page.

        for each example:
          <I total-updates> <I example-number>
          <I ticks-on-example> <I num-groups>
          for each tick on the example:
            <I tick-number> <I event-number>
    	for each WRITE_OUTPUTS group:
              <I num-units> <B targets?>
    	  for each unit:
                <R output-value> <R target-value>

`total-updates` is the total weight updates the network has had so far. This can be used to detect when the network has been reset. `example-number` is the index of the example in the set. This will be 0 for piped example sets. `ticks-on-example` is the number of ticks that will follow. `num-groups` is the number of groups with the WRITE_OUTPUTS type and thus the number of groups whose values will be written for each tick. The `event-number` is the event that was going on during the tick. This may be important for later analysis and in matching inputs with the recorded outputs. Note that this file format is not compatible with the example set format.

Note that target values occur for each unit in an OUTPUT group, but not for other groups. The `targets?` value is 1 if targets will be appearing for the group.

Also note that the output and target values are taken from the outputHistory and targetHistory arrays. Feedforward and simple recurrent networks will not record values into those arrays by default. You must give a group the USE_OUTPUT_HIST and USE_TARGET_HIST types to force it to store values in those arrays. Otherwise, the values written to the output file will not be accurate. Also, the history arrays must be at least as long as the maximum number of ticks in each example, or the values won't be correct. See the setTime command to learn more about this.

### Binary Format

The binary format is exactly the same as the text format, except that the fields are written in binary (in network byte ordering, which may be different from your machine's byte ordering). There is no extra space between fields.

Last modified: Mon Nov 20 17:24:09 EST 2000