A ModulatoryMechanism is a type of Mechanism that modifies the operation of one or more other Components. In general, a ModulatoryMechanism receives its input from an ObjectiveMechanism, however this need not be the case.
There are two primary types of ModulatoryMechanism:
valueof a Port of a Mechanism. Takes an evaluative signal (generally received from an ObjectiveMechanism) and generates a
control_allocation, each item of which is assigned to one of its ControlSignals; each of those generates a
control_signalthat is used by its ControlProjection(s) to modulate the parameter of a
function(and thereby the
value) of a Port. ControlSignals have costs, and a ControlMechanism has a
net_outcomethat is computed based on the
costsof its ControlSignals. A ControlMechanism can be assigned only the ControlSignal class of ModulatorySignal, but can be also be assigned other generic OutputPorts that appear after its ControlSignals in its
Gating Mechanism is a specialized subclass of ControlMechanism, that is used to modulate the
valueof an InputPort or OutputPort, and that uses GatingSignals which do not have any cost attributes.
matrixparameter of a MappingProjection. Takes an error signal (received from an ObjectiveMechanism or another LearningMechanism) and generates a
learning_signalthat is provided to its LearningSignal(s), and used by their LearningProjections to modulate the
matrixparameter of a MappingProjection. A LearningMechanism can be assigned only the LearningSignal class of ModulatorySignal as its OuputStates, but can be also be assigned other generic OutputPorts, that appear after its LearningSignals in its
A single ModulatoryMechanism can be assigned more than one ModulatorySignal of the appropriate type, each of which
can be assigned different
control_allocations (for ControlSignals) or
learning_signals (for LearningSignals). A single ModulatorySignal can also be
assigned multiple ModulatoryProjections; however, as described in ModulatoryProjections, they will all
be assigned the same
Naming Conventions for Modulatory Components¶
Modulatory Components and their attributes are named according to the type of modulation using the following templates:
- ModulatoryMechanism name
<Type>Mechanism (e.g., ControlMechanism)
- ModulatorySignal name
<Type>Signal (e.g., ControlSignal)
- ModulatoryProjection name
<Type>Projection (e.g., ControlProjection)
- List of a ModulatoryMechanism’s ModulatorySignals
<Type>Mechanism.<type>_signals (e.g., ControlMechanism.control_signals)
- Value of a ModulatorySignal
<Type>Signal.<type>_signal (e.g., ControlSignal.control_signal)
Creating a ModulatoryMechanism¶
A ModulatoryMechanism is created by calling the constructor for the desired type. ModulatoryMechanisms of the
appropriate subtype can also be created automatically when other Components are created that require them (for
example, one or more LearningMechanism are created when a
learning pathway is specified for a Composition (see subtypes of
ModulatoryMechanisms for more specific information about how to create them).
A ModulatoryMechanism has the same basic structure as a Mechanism. In addition, every ModulatoryMechanism
modulation attribute, that determines the default method by which its
ModulatorySignals modify the value of the Components that they modulate (see the modulation for a description of how modulation operates, and the documentation for individual
subtypes of ModulatoryMechanism for more specific information about their structure and modulatory operation).
The execution of a ModulatoryMechanism follows the same sequence of actions as a standard Mechanism
(Execution). However, in the context of a Composition, its ModulatoryProjections are often feedback
connections to other Mechanisms in the Composition, forming a cycle in the Composition,
and thus the ModulatoryMechanism may need to be properly initialized (see Cycles and Feedback).
Also, a ControlMechanism can be the
controller of a Composition in which case its
execution is handled separately from other Mechanisms in the Composition (see Controller Execution).
As noted below, the modifications made by a ModulatoryMechanism to a parameter that it modulates are not available to
that parameter’s Component until after the Modulatory executes, which may not be until the next
TRIAL (e.g., the
matrix parameter of a MappingProjection that is subject
to learning in a Composition; or a parameter modulated by a ControlMechanism that is the
controller of a Composition that executes last (see Controller Execution).
A Port that receives a ModulatoryProjection from a ModulatoryMechanism does not update its value until its owner Mechanism executes (see Lazy Evaluation for an explanation of “lazy” updating). This means that even if a ModulatoryMechanism has executed, a parameter that it modulates will not assume its new value until the Mechanism to which it belongs has executed.
- class psyneulink.core.components.mechanisms.modulatory.modulatorymechanism.ModulatoryMechanism_Base(default_variable, size, modulation, params, name, prefs, context=None, function=None, **kwargs)¶
Subclass of Mechanism that modulates the value(s) of one or more other Component(s). See Mechanism and subclasses for arguments and additional attributes.
ModulatoryMechanism is an abstract class and should never be instantiated by a call to its constructor. They should be instantiated using the constructor for a subclass.
determines how the output of the ModulatoryMechanism’s ModulatorySignal(s) are used to modulate the value of the Port(s) to which their ModulatoryProjection(s) project.
- exception psyneulink.core.components.mechanisms.modulatory.modulatorymechanism.ModulatoryMechanismError(error_value)¶