A ContrastiveHebbianMechanism always has two, and possibly three InputPorts:
- INPUT: receives external input to the Mechanism;
- TARGET: only implemented if target_size is specified, **separated =
True (default), and
mode is not SIMPLE_HEBBIAN; receives the
specified in the
run method of any Composition to which the Mechanism belongs.
The sizes of these are determined by arguments in its constructor, which generally conform to one of two
Standard Configuration – if input_size, hidden_size and target_size are all specified,
the sizes of the InputPorts are as follows:
INPUT: size = input_size
RECURRENT: size = input_size + hidden_size + target_size
TARGET: size = input_size
Simple Configuration – if target_size =
None or 0, separated =
False, and/or mode =
SIMPLE_HEBBIAN, the sizes of the InputPorts are as follows:
INPUT: size = input_size
RECURRENT: size = input_size + hidden_size
TARGET: Not implemented
If separated =
False and target_size is specified, a TARGET InputPort will be created, but
target_size must equal input_size or an error will be generated.
The values of input_size, hidden_size and target_size are assigned to the Mechanism’s
target_size attributes, respectively.
(if separated is
True) attribute(s), together with the separated attribute
are used to define the fields of the RECURRENT InputPort’s
value and the current_activity attribute used for updating values during execution,
- input_field: the leftmost number of elements determined by
- hidden_field: the elements of the RECURRENT InputPort and current_activity
that are not within the input_field and/or target_field;
- target_field: the rightmost number of elements determined by
otherwise, the same as input_field.
A ContrastiveHebbianMechanism is automatically assigned three OutputPorts:
- OUTPUT_ACTIVITY: assigned as the primary OutputPort, and contains the pattern
of activity the Mechanism is trained to generate. If target_size is specified, then it has the same size as
the TARGET InputPort; if target_size is not specified or is 0, if
False, or if mode is SIMPLE_HEBBIAN, then the size of the
OUTPUT_ACTIVITY OutputPort is the same as the INPUT InputPort (see Input).
- CURRENT_ACTIVITY: assigned the value of the
attribute after each execution of the Mechanism, which contains the activity of all
processing units in the Mechanism (input, hidden and/or target); has the same size as the RECURRENT InputPort.
These also appear in the ContrastiveHebbianMechanism’s
standard_output_ports, along with two others – MINUS_PHASE_ACTIVITY and
PLUS_PHASE_ACTIVITY – that it can be assigned, in addition to the
standard_output_ports of a RecurrentTransferMechanism.