11.2 Events, Patterns and their Specs

Events are the snapshots of the Environment presented to the Network. They represent a single coherent set of stimuli drawn from the environment. They are comprised of a set of patterns, which hold the information affecting the network on a layer by layer basis.

The structure of an event is determined by its corresponding EventSpec. Any changes made in the event spec are automatically made to all of the events that use that event spec. Thus, there must be one event spec for each different type of event created. Event specs reside in the environment itself, and not in the Project like other specs. The Event has a pointer to its spec, called spec. This works just like other spec pointers (see section 8.4 Specifications).

Both the Event and EventSpec objects are essentially just containers for their constituent Pattern and PatternSpec objects, which are also kept in one-to-one correspondence. Thus, any new pattern specs added in the pattern group in an event spec will result in corresponding patterns in the pattern group on the event. Different varieties of events will add event-level parameters like frequency and time (see section 11.9 Frequency Environments and Events, section 11.10 Other Environment Types).

A Pattern is simply a list of real numbers, which are kept in a floating-point Array object called value. It can be "applied" to a specified layer in the network. Each element of the value array in the Pattern corresponds to a Unit in the Layer. In addition, one can assign a flag to each value, which will alter how this value is applied to the units in the network. The flag member of a Pattern holds the flags, which are only present if the use_flags field in the corresponding pattern spec is set to USE_PATTERN_FLAGS or USE_PAT_THEN_GLOBAL_FLAGS. All of the flags are independent of each other and be either on or off. The meaning of the flag values are given in the PatFlags enumerated type in the PatternSpec and listed below.

TARG_FLAG
unit's TARG flag is set
EXT_FLAG
unit's EXT flag is set
COMP_FLAG
unit's COMP flag is set
TARG_VALUE
pattern value goes to the unit targ field
EXT_VALUE
pattern value goes to the unit ext field
NO_UNIT_FLAG
no unit flags are set, but value is set as normal
NO_UNIT_VALUE
don't set the unit's value, but flag as normal
NO_APPLY
don't apply this value to unit (no flags either)

The options include the ability to control how the unit's external input will be flagged, and where the value will be copied on the Unit (i.e., to its targ or ext field). This gives the user complete control over how the pattern value is presented.

Note that the value field is an float_RArray type, which has a range associated with it (hence the RArray), and it also has a number of other useful functions that enable the distance between two arrays to be computed, or various statistics like the mean, variance, etc. to be computed on a given array. These functions may be useful in creating and analyzing patterns.

The PatternSpec has several fields which determine where its corresponding pattern is presented, and what meaning it has to the network:

PatType type
The type of the pattern, which determines how the network will interpret its values. This can be one of the following values:
INACTIVE:
The corresponding pattern is not presented to the network.
INPUT:
The corresponding pattern is presented to the network as external input activation: the value is copied to the ext variable of the corresponding Unit, and the EXT flag is set on the ext_flags of the unit (and the layer the unit is in).
TARGET:
The corresponding pattern is presented to the network as target activation: the value is copied to the targ variable of the corresponding Unit, and the TARG flag is set on the ext_flags of the unit (and the layer the unit is in).
COMPARE:
The corresponding pattern is presented to the network as comparison pattern, which does not affect activation states or learning, but can be used to compare output values to expected ones via error statistics (e.g., the SE_Stat). The value is copied to the targ variable of the corresponding Unit, and the COMP flag is set on the ext_flags of the unit (and the layer the unit is in).

PatLayer to_layer
The network layer to present the Pattern to. This can be one of the following values:
FIRST:
Apply to the first layer in the network.
LAST:
Apply to the last layer in the network.
LAY_NAME:
Specify the Layer to apply to by name. The name should be set in the variable layer_name.
LAY_NUM:
Specify the Layer to apply to by layer number. The number should be set in the variable layer_num.

String layer_name
Contains the name of the layer to apply to (used if to_layer is set to LAY_NAME).
Int layer_num
Contains the number of the layer to apply to (used if to_layer is set to LAY_NUM).
TypeDef* pattern_type
Determines the type of Pattern object that is created in events that use this pattern spec. Changing this after events have already been created will not cause them to change pattern types. You have to remove the Events and start over if you want to change the types of patterns that are used.
LayerFlags layer_flags
Determines how the layer's ext_flags will be set. The DEFAULT is to set them according to the pattern type as described above, but they can be set to any of the possible combinations of flags (TARG, EXT, COMP), or to NO_LAYER_FLAGS at all. This can be useful if you have an pattern which uses flags for different values (see use_flags) so the layer actually receives multiple different kinds of external input.
PatUseFlags use_flags
Determines how the flag field of the Pattern and the global_flags of this PatternSpec will be used when applying the Pattern to the network. This can be one of the following values:
USE_NO_FLAGS:
Both pattern flags and global flags are ignored
USE_PATTERN_FLAGS:
Patterns flags are applied, global flags are ignored
USE_GLOBAL_FLAGS:
Global flags are applied, individual pattern flags are ignored
USE_PAT_THEN_GLOBAL_FLAGS:
If any flags are set on the pattern then use all the pattern's flag settings, otherwise apply the global flags for that pattern. Note that the choice of global versus pattern flags is not done individually by each flag on the pattern but rather as an all or nothing check on each pattern to determine if any of its flags are set.

int n_vals
The number of values to create in the corresponding pattern. It should be equivalent to the number of units in the corresponding layer. If this value is set to 0, it will be filled in with the number of units on the corresponding layer of the default network in the current project, if the layer can be found.
PosTDCoord geom
Determines the shape of the values as displayed in the EnviroView. It should correspond to the geom of the corresponding layer, and is initialized as such if possible.
PosTDCoord pos
The position of the start of the event in the EnviroView. Any overlap of displayed patterns is detected automatically, and the LinearLayout action on the EventSpec can be called to arrange the events linearly across or down the display.
float initial_val
The initial value that will be placed in newly created pattern value arrays.
Random noise
This adds random noise of the given specification as the pattern is applied to the network.
String_Array value_names
The elements in this array are in one-to-one correspondence with the values in the pattern, and can be used to label the patterns in the EnviroView (see section 11.4 The EnviroView).
int_Array global_flags
This contains flags that can apply (depending on use_flags) to all of the patterns, determining how they are presented.

Note: the following information should be useful to those who wish to program in PDP++, but is not necessary for the average user to understand.