11.9 Frequency Environments and Events

In the basic model of the environment, all events are equally likely to be presented to the network. However, this is often not the case in the real world. Thus, PDP++ provides a set of environmental types that implement frequency-based presentation of events. These are the FreqEvent, the FreqEvent_MGroup, and the FreqEnv types. As discussed above (see section 11.3 Representing Sequences of Events, section 11.1 Environments), processes can ask the Environment for a single Event or a Group of Events. The FreqEvent is an individual event with its own frequency, and the FreqEvent_MGroup is a group of events with an associated frequency.

The frequency model supported by these types has a number between zero and 1 associated with each event or event group. This frequency value is essentially a probability with which the event should be presented.

A FreqEnv environment type must be used in order for the frequency variable associated with events or groups to be used. This type of environment uses the InitEvents function to create the list of events or groups that will be presented for the current epoch. There are two modes of selecting these events according to their frequency. Setting sample_type to RANDOM results in a random sample of events to be presented for each epoch, with the probability of an event's inclusion proportional to its frequency value. The PERMUTED option instead adds a fixed number of a given event which is equal to the frequency of that event times the n_sample parameter.

The FreqEnv class also has the following variables which affect this sampling process:

int n_sample;
The number of samples of the Events or EventGroups to make per epoch. In the RANDOM case, this is the number of times to "roll the dice" to determine if a given event gets into the epoch. An event or group with a frequency of 1 will appear exactly n_sample times in a given epoch. Events with lower frequency will occur less often and with lower probability. In the PERMUTED case, this number is multiplied times the frequency to determine how many copies of an event or group appear in a given epoch.
FreqLevel freq_level
Has the values NO_FREQ, EVENT, or GROUP. It controls the level at which the frequency sampling occurs. If NO_FREQ is selected, frequency is ignored and the environment is just like the basic one. The other two options should be selected depending on the type of process that is being used--use GROUP for sequence-based processes (see section 11.3 Representing Sequences of Events), and otherwise use EVENT.

Note that there is also a FreqTimeEvent, FreqTimeEvent_MGroup, and FreqTimeEnv, which are frequency versions of the time-based environments described below.