15.4 Cs Proceses

The core set of Cs processes consist of a CsTrial process that performs the two phases of contrastive Hebbian learning (CHL), where each phase of settling is controlled by a CsSettle process, which in turn iterates over a number of individual CsCycle processing steps, each of which updates the activation state of the network. These processes fit nicely within the standard settling and cycle processes (see section 12.4 Schedule Processes for Different Time-Grains).

In addition, the CsSample process can be used to sample over trials in order to obtain a better sampling of activation states for weight updating, which is usually only necessary when trying to match a probabalistic output distribution (see section 15.7 The Probability Environment and Cs). It is created by default if using the `cs_prob_env.def' defaults file, but not otherwise.

The CsTrial process iterates over two loops of settle processing, one for each phase. It has the following variables:

Counter phase_no
The counter for this process, it goes from 1 to 2 for the two different phases.
Phase phase
The phase the process is in, which is just a more readable version of the counter: MINUS_PHASE and PLUS_PHASE.
StateInit trial_init
Indicates what to do at the start of each trial process. Typically, one wants to INIT_STATE, but it is also possible to DO_NOTHING or MODIFY_STATE, which could be redefined by a unit type to decay the activation state, for example (by default it just does an init state).
bool no_plus_stats
This flag means that statistics will not be recorded in the plus phase. This is useful because squared error, for example, is only meaningful in the minus phase, since the correct answer is clamped in the plus phase.
bool no_plus_test
This flag means that the plus phase will not be run if the epoch process indicates that it is in TEST mode (i.e., no learning is taking place).

The CsSettle process iterates over cycles of settling (activation updating). Like the trial_init of the trial process, the between_phases field of the settle process determines how the network state will be initialized between phases. Some people have claimed that learning works better if you do not INIT_STATE between phases (Movellan, 1990). However, the default is set to initialize the state, so that settling starts from the same initial conditions for both phases.

Also, the settle process allows the network to settle for some time before collecting statistics for learning. This time, determined by the start_stats parameter, allows the network to get into a stochastic equilibrium before measuring the activation states. If using a deterministic network, however, equilibrium is considered to simply be the final state of the network after settling. Setting the deterministic flag will only update the weights based on the final activation state.

The settle process will use the time field from a TimeEvent as a duration to settle on the event. Note that this is a non-standard use of this time field (see section 14.2.5 RBp Sequence Processes and TimeEvents).

The CsCycle process updates the activation state of the network. This can be done in one of two ways -- either all of the units are updated simultaneously (SYNCHRONOUS mode), or units are selected at random and updated one at a time, which is ASYNCHRONOUS mode. If the asynchronous mode is selected, one can perform multiple asynchronous updates per cycle. The number of units updated is determined by the n_updates variable. Note that the total number of updates performed is the product of n_updates and the number of cycles made during settling, so be sure to take that into account when setting the values of either of these parameters.

A variation of the synchronous mode is the SYNC_SENDER_BASED mode, which must be selected if IACUnitSpec's are being used, and the use_send_thresh flag is set. In this case, net input is computed in a sender-based fashion, meaning that the net input for each unit must first be initialized to zero, then accumulated. In standard receiver-based net input computation, the net input can be reset at the point an individual unit's net input is computed, so it doesn't have to be done for the entire network first. This is the different between SYNC_SENDER_BASED and SYNCHRONOUS. Asynchronous updating is not supported for sender-based updating. When the CsTrial process is ReInit'd or NewInit'd, it will automatically check for the correct pairing of the use_send_thresh and update_mode flags, and inform you if it needs to be changed.

The CsSample process has sample counter to keep track of the number of samples run. Set the max of this counter to 1 if you are running a deterministic network, or are not doing learning on probability distributions. This process iterates over the trial process, and only needs to be present when learning probabalistic output distributions.