Projections allow information to be passed between Mechanisms. A Projection takes its input from
sender and transmits that information to its
receiver of a Projection are always States:
sender is always the OutputState of a Mechanism; the
receiver depends upon the type of Projection. There are two broad categories of Projections,
each of which has subtypes that differ in the type of information they transmit, how they do this, and the type of
State to which they project (i.e., of their
- takes the
valueof an OutputState of a ProcessingMechanism converts it by convolving it with the MappingProjection’s
matrixparameter, and transmits the result to the InputState of another ProcessingMechanism. Typically, MappingProjections are used to connect Mechanisms in the
pathwayof a Process, though they can be use for other purposes as well (for example, to convey the output of an ObjectiveMechanism to a ModulatoryMechanism).
valueof a ModulatorySignal of a ModulatoryMechanism, uses it to regulate modify the
valueof an InputState, ParameterState or OutputState of another Component. ModulatorySignals are specialized types of OutputState, that are used to specify how to modify the
valueof the State to which a ModulatoryProjection projects. There are three types of ModulatoryProjections, corresponding to the three types of ModulatoryMechanisms (and corresponding ModulatorySignals; see figure), that project to different types of States:
- takes the
valueof a ControlSignal of a ControlMechanism, and transmit this to the ParameterState of a `ProcessingMechanism that uses this to modify the parameter of the (or its
function) for which it is responsible. ControlProjections are used when control has been used specified for a System.
Creating a Projection¶
A Projection can be created on its own, by calling the constructor for the desired type of Projection. More commonly, however, Projections are either specified in context, or are created automatically, as described below.
Specifying a Projection¶
Projections can be specified in a number of places where they are required or permitted, for example in the
specification of a
pathway for a Process, where the value of a parameter is specified
(e.g., to assign a ControlProjection) or where a MappingProjection is specified (to assign it a
LearningProjection). Any of the following can be used to specify a
Projection in context:
- Constructor – used the same way in context as it is ordinarily.
- Projection object – must be a reference to a Projection that has already been created.
- Projection subclass – creates a default instance of the specified Projection type. The assignment or creation of the Projection’s
senderis handled in the same manner as described below for keyword specifications.
Keyword – creates a default instance of the specified type, which can be any of the following:
- MAPPING_PROJECTION – if the
receivercannot be inferred from the context in which this specification occurs, then its initialization is deferred until both of those have been determined (e.g., it is used in the specification of a
pathwayfor a Process). For MappingProjections, a matrix specification can also be used to specify the projection (see value below).
- CONTROL_PROJECTION (or CONTROL) – this can be used when specifying a parameter using the tuple format, to create a default ControlProjection to the ParameterState for that parameter. If the Component to which the parameter belongs is part of a System, then a ControlSignal is added to the System’s
controllerand assigned as the ControlProjection’s
sender; otherwise, the ControlProjection’s initialization is deferred until the Mechanism is assigned to a System, at which time the ControlSignal is added to the System’s
controllerand assigned as its the ControlProjection’s
sender. See Specifying Parameters to Control for additional details.
- GATING_PROJECTION (or GATING) – this can be used when specifying an InputState or an
OutputState, to create a default GatingProjection to the State. If the GatingProjection’s
sendercannot be inferred from the context in which this specification occurs, then its initialization is deferred until it can be determined (e.g., a Gating Mechanism or GatingSignal is created to which it is assigned).
- value – creates a Projection of a type determined by the context of the specification, and using the specified value as the
valueof the Projection, which must be compatible with the
variableattribute of its
receiver. If the Projection is a MappingProjection, the value is interpreted as a matrix specification and assigned as the
matrixparameter of the Projection; it must be compatible with the
valueattribute of its
variableattribute of its
- Mechanism – creates a MappingProjection to either the primary InputState or primary OutputState, depending on the type of Mechanism and context of the specification.
- State – creates a Projections to or from the specified States, depending on the type of State and the context of the specification.
Specification dictionary – can contain an entry specifying the type of Projection, and/or entries specifying the value of parameters used to instantiate it. These should take the following form:
- PROJECTION_TYPE: <name of a Projection type> – if this entry is absent, a default Projection will be created that is appropriate for the context (for example, a MappingProjection for an InputState, a LearningProjection for the
matrixparameter of a MappingProjection, and a ControlProjection for any other type of parameter.
- PROJECTION_PARAMS: Dict[Projection argument, argument value] – the key for each entry of the dictionary must be the name of a Projection parameter, and its value the value of the parameter. It can contain any of the standard parameters for instantiating a Projection (in particular its sender and receiver, or ones specific to a particular type of Projection (see documentation for subclass). If the sender and/or receiver are not specified, their assignment and/or creation are handled in the same manner as described above for keyword specifications.
ProjectionTuple – a 4-item tuple used in the context of a State specification to create a Projection between it and another State. It must have at least the first three of the following items in order, and can include the fourth optional item:
- State specification – specifies the State to connect with (not the one being connected; that is determined from context)
- weight – must be a value specifying the
weightof the Projection; it can be
None, in which case it is ignored, but there must be a specification present;
- exponent – must be a value specifying the
exponentof the Projection; it can be
None, in which case it is ignored, but there must be a specification present;
- Projection specification – this is optional but, if included, msut be a Projection specification; it can take any of the forms of a Projection specification described above for any Projection subclass; it can be used to provide additional specifications for the Projection, such as its
matrixif it is a MappingProjection.
A ProjectionTuple should not be confused with a 4-item InputState specification tuple, which also contains weight and exponent items. In a ProjectionTuple, those items specify the weight and/or exponent assigned to the Projection (see Weight and Exponent), whereas in an InputState specification tuple they specify the weight and/or exponent of the InputState.
Any (but not all) of the items can be
None. If the State specification is
None, then there must be a Projection specification (used to infer the State to be connected with). If the Projection specification is
Noneor absent, the State specification cannot be
None(as it is then used to infer the type of Projection). If weight and/or exponent is
None, it is ignored. If both the State and Projection are specified, they must be compatible (see examples in State).
Under some circumstances Projections are created automatically. For example, a Process automatically creates a
MappingProjection between adjacent ProcessingMechanisms in its
pathway if none is specified; and LearningProjections are automatically created
learning is specified for a Process or System).
When a Projection is created, its full initialization is deferred until its
receiver have been fully specified. This allows a
Projection to be created before its
been created (e.g., before them in a script), by calling its constructor without specifying its sender or
receiver arguments. However, for the Projection to be operational, initialization must be completed by calling
_deferred_init method. Under most conditions this occurs automatically (e.g., when the projection is assigned
to a type of Component that expects to be the
for that type of Projection); these conditions are described in the section on Deferred Initialization for each type
of Projection. Otherwise, the Projection’s
_deferred_init method must be called explicitly, once the missing
attribute assignments have been made.
In addition to its
function, a Projection has two primary attributes: a
receiver. The types of State(s) that can be
assigned to these, and the attributes of those States to which Projections of each type are assigned, are
summarized in the following table, and described in greater detail in the subsections below. In addition to the
State attributes to which different types of Projections are assigned (shown in the table), all of the Projections
of a State are listed in its
|Projection||sender (attribute)||receiver (attribute)|
||InputState or OutputState
This must be an OutputState or a ModulatorySignal (a subclass of OutputState specialized for
ModulatoryProjections). The Projection is assigned to the OutputState or ModulatorySignal’s
efferents list and, for ModulatoryProjections, to the list of ModulatorySignals specific to
the ModulatoryMechanism from which it projects. The OutputState or ModulatorySignal’s
value is used as the
variable for Projection’s
A sender can be specified as:
- an OutputState or ModulatorySignal, as appropriate for the Projection’s type, using any of the ways for specifying an OutputState.
sender is not specified and it can’t be determined from the context, or an OutputState
specification is not associated with a Mechanism that can be determined from , then the initialization of the
Projection is deferred.
receiver required by a Projection depends on its type, as listed below:
receiver can be specified as:
- an existing State;
- an existing Mechanism or Projection; which of these is permissible, and how a state is assigned to it, is determined by the type of Projection — see subclasses for details).
- a specification dictionary (see subclasses for details).
Weight and Exponent¶
Every Projection has a
exponent attribute. These
are applied to its
value before combining it with other Projections that project to the same
States. If both are specified, the
exponent is applied before the
weight. These attributes determine both how the Projection’s
value is combined
with others to determine the
variable of the State to which they project.
ParameterStates and Parameters¶
ParameterStates provide the value for each parameter of a Projection and its
function. ParameterStates and their associated parameters are handled in the same way by
Projections as they are for Mechanisms (see ParameterStates and Parameters for details). The ParameterStates for a
Projection are listed in its
A Projection cannot be executed directly. It is executed when the State to which it projects (i.e., its
receiver) is updated; that occurs when the State’s owner Mechanism is
executed. When a Projection executes, it gets the value of its
sender, assigns this as the
variable of its
function, calls the
function, and provides the result as to its
function of a Projection converts the value received from its
a form suitable as input for its
Base class for all Projections.
Projection is an abstract class and should NEVER be instantiated by a direct call to its constructor. It should be created by calling the constructor for a subclass` or by using any of the other methods for specifying a Projection.
State – State from which Projection receives its input (see Sender for additional information).
State – State to which Projection sends its output (see Receiver for additional information)
value – output of Projection, transmitted to variable of function of its
ContentAddressableList[str, ParameterState] – a list of the Projection’s
ParameterStates, one for each of its specifiable parameters and those of its
function(i.e., the ones for which there are arguments in their constructors). The value of the parameters of the Projection are also accessible as attributes of the Projection (using the name of the parameter); the function parameters are listed in the Projection’s
function_paramsattribute, and as attributes of the Function assigned to its
ContentAddressableList[str, ParameterState] – a read-only list of the Projection’s ParameterStates, one for each of its configurable parameters, including those of its
function. The value of the parameters of the Projection and its
functionare also accessible as (and can be modified using) attributes of the Projection, in the same manner as they can for a Mechanism).
str – the name of the Projection. If the Projection’s initialization has been deferred, it is assigned a temporary name (indicating its deferred initialization status) until initialization is completed, at which time it is assigned its designated name. If that is the name of an existing Projection, it is appended with an indexed suffix, incremented for each Projection with the same base name (see Naming). If the name is not specified in the name argument of its constructor, a default name is assigned by the subclass (see subclass for details)
PreferenceSet or specification dict – the
PreferenceSetfor the Projection; if it is not specified in the prefs argument of the constructor, a default is assigned using
classPreferencesdefined in __init__.py (see PreferenceSet for details).
Read-only access to _parameter_states